Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Nested Editing Contexts





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:
http://lists.apple.com/mailman/options/webobjects-dev/email@hidden

This email sent to email@hidden

References: 
 >Nested Editing Contexts (From: "Ted Archibald" <email@hidden>)
 >Re: Nested Editing Contexts (From: Steven Mark McCraw <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.