Re: processRecentChanges without UndoManager
Re: processRecentChanges without UndoManager
- Subject: Re: processRecentChanges without UndoManager
- From: Chuck Hill <email@hidden>
- Date: Wed, 03 Nov 2004 10:11:36 -0800
It is a bug in the handling of exceptions raised when validating a delete.
Though the actual root issue is somewhat up for debate. IMHO, if the EC
needs a undo manager for this internal processes it should damn well create
its own and not mess with mine! To make this really, really fun -- wait
for it -- if you _do_ have an undo manager and validateForDelete raises,
then the undo manager is rolled back one or more undo group _too far_.
Yep, so not only does it recover from the failed deletion it (and I really,
really love this) rolls all the objects in the EC to their state before the
last save. Imagine the fun that I had tracking that bug down. So now I
try to ensure that validateForDelete can't raise before I call saveChanges
and remove all actions from the undo manager immediately after a successful
save. From all this I deduce that very few people are using deny delete
rules or otherwise causing validateForDeletion to raise.
Chuck
At 10:55 AM 03/11/2004 -0700, Christian Pekeler wrote:
>I don't explicitly use an undo manager in my WO project. The
>documentation for EOEditingContext.setUndoManager says:
>
>> You might invoke this method with null if the application doesn't need
>> undo and you want to avoid the overhead of an undo stack.
>
>
>It seems like EOEditingContext is using the undo manager internally,
>because if I do this:
>
>editingContext.setUndoManager(null);
>UndeletableEntity undeletableEntity = new UndeletableEntity();
>editingContext.insertObject(undeletableEntity);
>editingContext.deleteObject(undeletableEntity);
>editingContext.saveChanges();
>
>with:
>
>public class UndeletableEntity extends EOGenericRecord {
> ...
> public void validateForDelete() throws
>NSValidation.ValidationException {
> super.validateForDelete();
> throw new ValidationException("preventing deletion for testing
>purposes");
> }
>}
>
>I get:
>
>java.lang.IllegalStateException: Editing context needs an undo manager
>to recover from delete propagation problems. Do not set the undo
>manager of this editing context to null
> at
>com.webobjects.eocontrol.EOEditingContext._processRecentChanges(EOEditin
>gContext.java:1694)
> at
>com.webobjects.eocontrol.EOEditingContext._prepareForPushChanges(EOEditi
>ngContext.java:3179)
> at
>com.webobjects.eocontrol.EOEditingContext.saveChanges(EOEditingContext.j
>ava:3135)
>
>So apparently it is not OK to set the undo manager to null. Am I
>misunderstanding something or is this a bug in
>EOEditingContext._processRecentChanges()?
>
>
>Thanks,
>Christian
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Webobjects-dev mailing list (email@hidden)
>Help/Unsubscribe/Update your Subscription:
e.net
>
>This email sent to email@hidden
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
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