Re: Change Object in EOSharedEditingContext
Re: Change Object in EOSharedEditingContext
- Subject: Re: Change Object in EOSharedEditingContext
- From: Art Isbell <email@hidden>
- Date: Fri, 19 Mar 2004 15:11:36 -1000
On Mar 19, 2004, at 2:38 PM, Xia, Wen wrote:
I have a fetch spec that returns the results from the database into a
NSMutableArray array1. When I try to manipulate the data in array1
(not
update to the database), I always get the error of
java.lang.IllegalArgumentException: attempt to change object in a
shared
editing context. I tried to create array2 using array2 =
array1.mutableClone(), and manipulate data in array2 instead, the same
problem persists. Does that mean array2 is still under the control of
EOSharedEditingContext?
The array isn't but the objects that it contains are. Whenever you
change the value of an attribute of an EO, EOF is notified. Because
these EO's have been fetched into a shared editing context, they cannot
be changed, at least the way you're attempting to do so. You might
follow the procedure described in the EOSharedEditingContext class
description: create a new editing context, send it a
setSharedEditingContext(null) message, create copies of the objects you
want to modify in this new editing context
(EOUtilities.localInstancesOfObjects()), then modify them. If you want
to save the changes, the copies in the shared editing context should be
automatically updated.
Aloha,
Art
_______________________________________________
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.