Re: local instances, child contexts, related EOs
Re: local instances, child contexts, related EOs
- Subject: Re: local instances, child contexts, related EOs
- From: Chuck Hill <email@hidden>
- Date: Sun, 21 Dec 2008 18:53:00 -0800
On Dec 21, 2008, at 6:28 PM, Tom Woteki wrote:
Hi All:
I've looked in various online tutorials etc but I haven't found the
answer to this question: when I create a local instance of an EO in
a child context, how to do I conveniently cause the related EOs to
be brought along into the child EC? I'm assuming there must be a
method or standard way of doing this but I can't see it.
You don't need to do anything. The related objects will be faults
until you reference some data from them, at which point the fault will
be fired. As the fault is in an EC with a parent EC, the fault will
be resolved from the parent EC rather than the object store. If the
EO is not in the parent EC, then it will fall back to the object store
and then back to the DB if there is no snapshot in the object store.
I have tried this:
EOEditingContext ec, localEC;
myLocalEO = ec.localInstanceOfObject(localEC, myEO);
myLocalEO.updateFromSnapshot(myLocalEO.snapshot());
but this only results in faults for the related objects.
The second line is not and faults for the related objects is normal.
What is the practice for obtaining local copies of an EO and all its
related EOs? I want to do this in order to edit the locals in the
child EC.
Just edit them as you would in any other situation. It just works.
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