Re: Setting EOEditingContext's Undo Manager to null
Re: Setting EOEditingContext's Undo Manager to null
- Subject: Re: Setting EOEditingContext's Undo Manager to null
- From: Chuck Hill <email@hidden>
- Date: Mon, 08 Dec 2003 10:32:48 -0800
- Organization: Global Village Consulting, Inc.
The exception is correct. The implementation of EOEditingContext
requires an undo manager to process deletions. You can set the undo
manager to null only if you don't need to delete.
You might want to consider creating a special EC with an undo manager
just to process the deletion:
EOEditingContext ec = new EOEditingContext();
ec.lock();
try {
EOEnterpriseObject eo = EOUtilities.localInstanceOfObject(ec,
eoToDelete);
ec.delete(eo);
ec.saveChanges();
}
finally {
ec.unlock();
ec.dispose();
}
Chuck
Serge Froment wrote:
Hi,
I have several locally created editing context I use to make some EO
manipulations. I used to set the undo manager to null for those editing
contextes to avoid the overhead. But now, when I delete EO using such
an editing context with WO 5.2.2, I get an exception saying that
"Editing context needs an undo manager to recover from delete
propagation problems. Do not set the undo manager of this editing
context to null". (See full stack trace below)
However, the documentation of EOEditingContext.setUndoManager still
says: "Sets the receiver's NSUndoManager to undoManager. 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.".
Is this a bug or a feature?
Serge Froment
http://www.serge-froment.com
Full stack trace of the exception:
[2003-12-08 11:17:20 EST] <WorkerThread10>
<com.webobjects.appserver._private.WOComponentRequestHandler>:
Exception occurred while handling request:
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
[2003-12-08 11:17:20 EST] <WorkerThread10>
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.processRecentChanges(EOEditing
Context.java:1878)
at
com.webobjects.eocontrol.EOEditingContext._processEndOfEventNotification
(EOEditingContext.java:2138)
at sun.reflect.GeneratedMethodAccessor98.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.webobjects.foundation.NSSelector.invoke(NSSelector.java:354)
at
com.webobjects.foundation.NSSelector._safeInvokeSelector(NSSelector.java
:108)
at
com.webobjects.foundation.NSDelayedCallbackCenter$NSLightInvocation.invo
ke(NSDelayedCallbackCenter.java:242)
at
com.webobjects.foundation.NSDelayedCallbackCenter._eventEnded(NSDelayedC
allbackCenter.java:208)
at
com.webobjects.foundation.NSDelayedCallbackCenter.eventEnded(NSDelayedCa
llbackCenter.java:171)
at
com.webobjects.appserver.WOApplication.saveSessionForContext(WOApplicati
on.java:1522)
at
com.webobjects.appserver._private.WOComponentRequestHandler._dispatchWit
hPreparedApplication(WOComponentRequestHandler.java:329)
at
com.webobjects.appserver._private.WOComponentRequestHandler._handleReque
st(WOComponentRequestHandler.java:358)
at
com.webobjects.appserver._private.WOComponentRequestHandler.handleReques
t(WOComponentRequestHandler.java:432)
at
com.webobjects.appserver.WOApplication.dispatchRequest(WOApplication.jav
a:1308)
at
com.webobjects.appserver._private.WOWorkerThread.runOnce(WOWorkerThread.
java:173)
at
com.webobjects.appserver._private.WOWorkerThread.run(WOWorkerThread.java
:254)
at java.lang.Thread.run(Thread.java:554)
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
Progress is the mother of all problems.
- G. K. Chesterton
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.