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 PROTECTED]> 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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to