Re: When (not) to use session().defaultEditingContext()
Re: When (not) to use session().defaultEditingContext()
- Subject: Re: When (not) to use session().defaultEditingContext()
- From: Jake MacMullin <email@hidden>
- Date: Mon, 01 Nov 2004 13:29:14 +1100
So, can I just summarise my understanding of the collective wisdom:
The default editing context has a (relatively) long life, therefore it is
important to keep the following in mind:
When saving changes to the default editing context make sure you're not
saving changes that should not be saved.
If you get data from the default editing context it could be stale (but this
isn't a problem if you've made all your changes through the default editing
context).
An alternative to using the default editing context is to use a new
EOEditingContext for each discrete interaction with the data store. This
helps prevent the problems identified above, but introduces the need to
explicitly lock() and unlock() the editing context.
Sometimes it is difficult to 'isolate' part of the object graph to use in a
separate editing context. In particular, some applications will have complex
relationships extending from an object that lives in the Session (such as a
User).
So, as I see it (and I may be missing something here), the decision to use
the default editing context or not depends on weighing the difficulties of
making sure you don't accidentally save unwanted changes against the
difficulties of making sure related objects aren't registered in different
editing contexts (and having to explicitly lock and unlock).
Is this an accurate summary of the decision? Or are there factors I'm not
taking in to account.
Regards,
Jake MacMullin
_______________________________________________
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