Re: Nested Editing Contexts
Re: Nested Editing Contexts
- Subject: Re: Nested Editing Contexts
- From: Lachlan Deck <email@hidden>
- Date: Thu, 31 May 2007 08:32:26 +1000
On 31/05/2007, at 8:15 AM, Chuck Hill wrote:
On May 30, 2007, at 12:57 PM, Steven Mark McCraw wrote:
B) Programmatically constrain programmers to follow those rules.
Since changing the state of an object is so catastrophic if the
object is not in the pool that enables it to be tracked, why not
throw an exception when that condition is encountered, rather than
just letting the programmer proceed and wander into the terrible
limbo of a hosed database context and all sorts of strange,
untraceable and difficult to reproduce behavior?
I have often wondered that. Now you have gone and provoked me. I
will file a bug report. You _can_ do this yourself by adding this
to your base EO class:
public void willRead() {
if (editingContext() == null) {
throw new IllegalStateException("Access of instance of " +
entityName() + " that has not been inserted into an
EOEditingContext or whose EOEditingContext has been disposed");
}
super.willRead();
}
perhaps willChange and willReadRelationship are also worth the same
treatment(?)
with regards,
--
Lachlan Deck
_______________________________________________
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