Re: Editing context that dont communicate changes.

Pierre Bernard <[email protected]> Thu, 6 Mar 2003 19:55:59 +0100
Newsgroups gmane.comp.web.webobjects.devel,gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
At 11:17 -0300 3/5/03, Ing.Gaston Blanco wrote:
> I want that the objets in my Editing Context are never changed 
> automatically because of a saveChanges() in another editing context of 
> the same ObjectStoreCoordinator.

Hi!

What you could try is to prevent your editing context from receiving 
the ObjectsChangedInObjectStoreNotification by unregistering it editing 
context from the notification center like so (I guess this is WO 4.5 
code, check the name of the notification):

NSNotificationCenter nsnotificationcenter = 
NSNotificationCenter.defaultCenter();
nsnotificationcenter.removeObserver(editableContext, 
"EOObjectsChangedInStoreNotification", 
editableContext.parentObjectStore());

I played around with this a while back. What happened was that the 
second editing context to commit succeeded and overwrote the changes 
made by the first one. It even overwrote attributes that were not 
modified locally with the value previous to the first commit. I.e. 
instead of the desired "first wins" situation I got a "last wins" 
situation. Thus I went off to other solutions.

I leave it up to you to determine what harm could stem from disabling 
this notification.

Pierre

--
Got time to spare? Why don't you visit my web site?
http://homepage.mac.com/I_love_my