Re: Multiple instances of EOModel in an application.
Re: Multiple instances of EOModel in an application.
- Subject: Re: Multiple instances of EOModel in an application.
- From: Marek Wawrzyczny <email@hidden>
- Date: Thu, 24 Jun 2004 17:27:20 +1000
On 24/06/2004, at 16:22, Art Isbell wrote:
On Jun 23, 2004, at 6:14 PM, Marek Wawrzyczny wrote:
Has anyone tried to concurrently use many instances of the same
EOModel, linked to different databases in a single application?
We are evaluating this possibility. We have several identical
databases which we'd hope to update using WebServices through a
single WO app. All EOs have the same business logic. This app would
ideally choose the right data source depending on the login info. As
far as I can tell this is only possible if the none of the EO share
the same entity name.
The restriction is that the names of all entities loaded into an
EOModelGroup must be unique. All eomodels in an app and in any
frameworks linked to the app are loaded into a single EOModelGroup.
So you'd need to rename the entities in each identical eomodel so that
all entity names are unique. I'm not certain, but I don't believe
there'd be any problem with identical entities with different names
sharing the same EO class.
Maybe you could devise an entity name suffix that's tied to the
particular database being accessed. Then any entity name reference in
your code could be a String that would be dynamically assigned the
appropriate entity name based on the database being accessed.
This is all off the top of my head, so I've undoubtedly overlooked
some critical detail that will blow this whole thing out of the water
:-)
Thanks Art,
That's pretty much what I followed from the docs... mind you, since I
foresee many of these identical models being added, I was envisaging a
slightly more radical (and less involving) approach.
First I have to add that for this app we have already subverted
WOApplication to use Apache's XML-RPC framework. In fact we're not even
using WebObjects as such to serve anything out other than the admin
pages and stats.
An XML-RPC server and client does all the communications. I was however
hoping that we could somehow use multiple instances of EODatabase and
other relevant classes to simply "choose" the right
EODatabaseContext/EOEditingContext at runtime, depending on which
database we need to handle... Furthermore, we'd only ever need one
EOModel and simply use it to instantiate all the database contexts
while programatically changing its connection dictionary... we could
read these from a configuration file meaning that we'd never have to
recompile the app if we add another database to the pool...
The problem is that I have not dealt with the EODatabase hierarchy
before and don't want to find weeks into development that this is not
possible.
I know I could probably not use WebObjects for this app and just use
EOF, but I'd like to keep using WOApplication for this application as
it provides a consistent way of managing all our apps on the server.
Cheers,
Marek Wawrzyczny
software engineer
-------------------------->
ish group pty ltd
http://www.ish.com.au
7 Darghan St Glebe 2037 Australia
phone +61 2 9660 1400 fax +61 2 9660 7400
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.