Re: follow relationship after moving to different EC?
Re: follow relationship after moving to different EC?
- Subject: Re: follow relationship after moving to different EC?
- From: Robert Walker <email@hidden>
- Date: Thu, 5 Aug 2004 11:02:52 -0400
Nathan,
If you get a local instance of one object in a new EOEditingContext
from an existing EOEditingContext, any object that you add it its
relationships must also be local to the new editing context.
Essentially, what EOUtilities.localInstanceOfObject() does is to use
faultForGlobalID to create a new fault object in the destination
EOEditingContext.
You should be able to use the following EOUtility method to get local
instances of all the objects you need to work with:
public static NSArray localInstancesOfObjects(EOEditingContext ec,
NSArray objects)
I'm not sure why it's necessary to "move" the object to another
EOEditingContext besides the default one. But the above should give
you what you want anyway.
If you are simply following a relationship in the local instance then
the standard fault firing mechanism should fetch the objects of the
relationship in the new EOEditing context as you would expect. At
least this what I expect to happen.
I have a feeling that you are either attempting to assign an object
from the default context to your local instance, or you are trying to
assign an object in the new context back to an object in the default
context.
I imagine the EOEditingContext as a box (or bucket) that you put object
instances into. An object must be in the same box to have a
relationship with another object instance. This system is designed to
maintain internal consistency with the objects in a particular object
graph.
Hope this helps...
On Aug 5, 2004, at 9:49 AM, Nathan Dumar wrote:
I'm working on one of my bugs, and realized I was counting on a
certain behavior that may not be true.
After moving an object from the default editing context to a new
editing context, I'm following a relationship on that object (one user
to many locations) and using those objects "as is," without
specifically moving them from the other editing context. Is this
allowed?
The error message is (sorry, can't get to it right now to copy it)
tells me that WO can't put objects together from different editing
contexts.
So, if what I described above is allowable, then I need to keep
looking for that stray object from a different editing context.
Thank you,
Nathan
_______________________________________________
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.
--
Sincerely,
Robert Walker
Programmer
Bennett Technology Group
_______________________________________________
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.