Re: Nested Editing Contexts
Re: Nested Editing Contexts
- Subject: Re: Nested Editing Contexts
- From: "Ted Archibald" <email@hidden>
- Date: Thu, 31 May 2007 01:15:45 -0600
So, if I use ERXEC is there anything else I have to concern myself about? Is all the locking taken care of that I need to worry about?
IOW, I can just go into my code and any instances I have of a defaultEC for creating and inserting objects I can simply use ERXEC keeping in mind that I need to retrieve local instances of other objects if need be.
On 5/30/07, Steven Mark McCraw <email@hidden> wrote:
Hi Ted,
...
So, at the page
level, I create a peer ec:
EOEditingContext _peerEC =
ERXEC.newEditingContext();
and then use it to create the new objects:
MyEO eo = (MyEO)EOUtilities.createAndInsertInstance(_peerEC, "MyEO");
There are plenty of gotchas to be aware of here, mainly that if you
are relating your newly created objects to objects that are contained
in another editing context, you have to first bring those other
options into the peer:
OtherEO oeo = (OtherEO)EOUtilities.localInstanceOfObject(_peerEC, oeo);
(or use EOUtilities.localInstancesOfObjects(EOEditingContext, NSArray
to do a whole set at once).
Hope this helps. Getting past these issues was a bitter struggle for
me, and I wasn't even aware of all of the various problems (like
having to have an EO in and editing context before doing ANYTHING to
it) for several years. Trust me, better to start off following the
rules people have figured out from experience than to have to go back
later and refactor tons of code to fit those rules.
Mark
_______________________________________________
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