• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: two databases from one application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: two databases from one application


  • Subject: Re: two databases from one application
  • From: Patrick Middleton <email@hidden>
  • Date: Thu, 11 May 2006 11:22:34 +0100


On 10 May 2006, at 17:20, Milan M wrote:

Hello all,

WO application I am working on was pretty simple up to this point: one apache webserver and one databaseserver serving data to it. The things turned more complicated now: In addition to the first database, we now want to add access to another database. Both of these databases have identical schema, and the tables in question are identical. Think of the second database as a backup.

At one point in the applicaiton, I want to take an enterprise object generated in defaultEditingContext and to save it to the other database.

I've dealt with this problem in EOF2.1 to EOF4.5 . EOEntity names had to be unique across an eomodel group. I haven't done any similar work in EOF 5.x, but the general fix *should* be the same. One need to create two or more entirely separate EOF object graphs; have a look at http://developer.apple.com/documentation/webobjects/Reference/ API/com/webobjects/eocontrol/EOObjectStoreCoordinator.html , especially the static methods setDefaultCoordinator() and defaultCoordinator() .


One will probably need, for one's own sanity, to avoid using the session default editing context, which will mean needing to manage locking oneself in any editing contexts one creates, presumably at least one per each EOF stack.

Looking at http://developer.apple.com/documentation/webobjects/ Reference/API/com/webobjects/eocontrol/EOEnterpriseObject.html , registering the same object in more than one editing context should not be expected to work [see the doco for editingContext()], even in entirely separate EOF object graphs. EOGlobalIDs should work, and the snapshot methods in both com.webobjectseocontrol.EOEnterpriseObject and com.webobjects.eoaccess.EODatabase will work.

So depending on exactly what my needs were, I might end up fetching from one database, obtaining row snapshots in the EOAccess layer, then doing some work at the EOAccess level using the other EOF object graph to write an equivalent set of snapshots into the other database.


Complicated? Certainly. But this approach does work.


-- Patrick Middleton OneStep Solutions plc 351 London Road Phone: +44 (0)1702 426400 Hadleigh Fax: +44 (0)1702 556855 Essex. SS7 2BT Email: email@hidden England (MIME welcome)

_______________________________________________
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


References: 
 >two databases from one application (From: Milan M <email@hidden>)

  • Prev by Date: Re: Foreign Key Constraints
  • Next by Date: Re: two databases from one application
  • Previous by thread: Re: two databases from one application
  • Next by thread: Re: two databases from one application
  • Index(es):
    • Date
    • Thread