I don't want EOSharedEditingContext !!
I don't want EOSharedEditingContext !!
- Subject: I don't want EOSharedEditingContext !!
- From: Martin Hofmann <email@hidden>
- Date: Thu, 13 Jan 2005 11:55:07 -0800
I am trying to use nested EOEditingContext as described in the Apple
documentation
(http://developer.apple.com/documentation/WebObjects/Reference/API5.2/index.html).
But I keep getting my object in an EOSharedEditingContext. This of
course creates all sorts of problems when I try and edit the record.
I have tried to disable SharedEditingContext but to no avail.
Details:
1) in Application.java I try to disable SharedEC
EOSharedEditingContext.setDefaultSharedEditingContext(null);
2) in Session I create a nested EC
authEC = defaultEditingContext();
recordEC = new EOEditingContext(authEC);
2) Next I fetch a list of records from the database into my default EC
photolist = new NSMutableArray(
authEC.objectsWithFetchSpecification(fetchSpec, authEC));
this works fine.
3) Now I want to edit a single record in nested EC, so I try to make a copy
EOEditingContext authEC = ePhoto.editingContext();
System.out.println("EditRecord edit photo ec = "+authEC+
"\n child of:"+authEC.parentObjectStore());
EOGlobalID gid = authEC.globalIDForObject(ePhoto);
System.out.println("gid = "+gid);
System.out.println("EditRecord recEC = "+recordEC+
"\n child of: "+recordEC.parentObjectStore());
photo = (PhotoData)recordEC.faultForGlobalID(gid, recordEC);
System.out.println("setPhoto: ec = "+photo.editingContext()+
"\n child
of:"+photo.editingContext().parentObjectStore());
Well that doesn't work, try localInstanceOfObject (may be the same thing)
photo = (PhotoData)EOUtilities.localInstanceOfObject(recordEC,
ePhoto);
System.out.println("setPhoto: ec ="+photo.editingContext()+
"\n child of:
"+photo.editingContext().parentObjectStore());
The output of this section shows the problem:
EditRecord edit photo ec =
com.webobjects.eocontrol.EOEditingContext@891a0
child of: com.webobjects.eocontrol.EOObjectStoreCoordinator@4d2125
gid = _EOIntegralKeyGlobalID[PHOTODATA (java.lang.Long)11487]
EditRecord recEC = com.webobjects.eocontrol.EOEditingContext@6788c4
child of: com.webobjects.eocontrol.EOEditingContext@891a0
Everything seems OK to here
setPhoto: ec = com.webobjects.eocontrol.EOSharedEditingContext@51e0c4
child of: com.webobjects.eocontrol.EOObjectStoreCoordinator@4d2125
setPhoto: ec = com.webobjects.eocontrol.EOSharedEditingContext@51e0c4
child of: com.webobjects.eocontrol.EOObjectStoreCoordinator@4d2125
Why is the EditingContext of photo Shared??
Thanks in advance
Martin Hofmann
--
Martin Hofmann Unix Systems Administrator
email@hidden Library Systems Services
Ph: (250) 472-5069 McPherson Library, University of Victoria
_______________________________________________
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