Re: Per Session model connection and EOCooperatingObjectStore
Re: Per Session model connection and EOCooperatingObjectStore
- Subject: Re: Per Session model connection and EOCooperatingObjectStore
- From: Chuck Hill <email@hidden>
- Date: Tue, 3 Mar 2009 10:49:34 -0800
On Mar 3, 2009, at 10:46 AM, Larry Mills-Gahl wrote:
On Mar 3, 2009, at 11:24 AM, Chuck Hill wrote:
On Mar 3, 2009, at 8:02 AM, Laurence Mills-Gahl wrote:
I am going around in circles with a per-session eomodel connection
and I am looking for advice.
I have two models. One with data common to all application
sessions and one with data that should be used for connecting to a
database determined by data in the common model. This is the same
as the setup in EOEditingContext docs "Getting Data from Multiple
Sources". The difference is that one of the models is a per-
session connection model
That is a very, very large difference.
and the other is (or at least can be) consistently connected to a
single database.
That is not how EOF works.
Forgive me for misspeaking. What I should have said to be more clear
is that the common model does not need to have it's connection
dictionary changed at runtime (based on some action of the user in a
session). That is what I meant by saying it can be consistently
connected to a single database.
I was thinking more that regardless of which database it is connected
to, it needs to be in each model group if there are relationships
between it and the dynamically connected models.
The problem that I am running into is in changing the connection
of the session specific model and running into adaptorChannel
problems. I feel like I'm facing the wrong direction in looking
for an answer because the usual answer to my questions about
webobjects is that someone has figured this out before and it is
much more straight forward than I can see at the moment.
Should I be looking to remove the EOCooperatingObjectStore related
to the dynamic model, create a new one, add it to the
EOObjectStoreCoordinator for the session editing context? Does
anybody have any advice or examples or docs that might help with
this?
You will need to create a new EOModelGroup, load the dynamic model
into it, modify the dynamic model, and create a new EOF stack
using the model group for each session. If you are doing this, the
EOF default*() methods are to be avoided. I'd really try and find
another way to do this.
Thank you for the comments. I am looking for another way to do this
and have not thought of a way other than to either flatten everybody
into one database (which is not a good idea for this app) or
duplicate all of the common data in every database (which is
possible, but inefficient and adds another management task to keep
the common data in sync)
Does avoiding the default* methods include avoiding the Sessions
defaultEditingContext() if I setup the defaultEditingContext like:
EOObjectStoreCoordinator osc = new EOObjectStoreCoordinator();
this.setDefaultEditingContext(new EOEditingContext(osc));
If you change it like that, it is not longer the default. :-) So
yes, that will work.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden