The more I think about it, why would you ever need to use a nested
editing context instead of a component level peer editing context?

Each time you find yourself writting something like:

child_ec.savechanges();
parent_ec.saveChanges();

you could probably have used a peer context instead of a nested context.

But there are cases were you want to do some editing between doing child_ec.savechanges(); and parent_ec.saveChanges();. Then you should use a child (nested) context.

As another example, if you do something like:

EOEditingContext ec1 = new EOEditingContext();
EOEditingContext ec2 = new EOEditingContext();
EntityA a = new EntityA();
ec1.insertObject(a);
EntityA local_a = (EntityA) EOUtilities.localInstanceOfObject(ec2,a);

Then local_a is going to be null, and can't be used.

If you do:

EOEditingContext ec1 = new EOEditingContext();
EOEditingContext ec2 = new EOEditingContext(ec1);
EntityA a = new EntityA();
ec1.insertObject(a);
EntityA local_a = (EntityA) EOUtilities.localInstanceOfObject(ec2,a);

Then local_a can be used...

JPM






_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
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