On Wednesday, May 31, 2006, at 04:24PM, Kieran Kelleher <[EMAIL PROTECTED]> 
wrote:
> I have a newly created object in an editing context and I am making a local 
> instance of it in a another editing context ..... however 
> localInstanceOfObject always returns null!! What gives?!

Hi Kieran,

localInstanceOfObject() uses EOEditingContext's faultForGlobalID() method.
faultForGlobalID() should find a new, unsaved EO's which are:
1) registered in the receiving EOEditingContext
2) registered in the attached shared EOEditingContext
3) registered in a parent object store
(Note: I say should because I'm not sure about case #2.  I have code to demo
cases 1 and 3 which I wrote to answer a similar question at WWDC last year. 
I may have even posted it to the list but I'm not sure if it got cleaned up for 
that. ;-)

To bring this back to your code, referencing the following line;
_job = (CTJob)EOUtilities.localInstanceOfObject( defaultEditingContext(), job );

>From your logs and code, it seems that job is new, temporary EO and that job 
>is registered in some EC that is different from defaultEditingContext().  Thus 
>for localInstanceOfObject() to be able to resolve your request,  the 
>editingContext which contains 'job' would need to be parent to the 
>defaultEditingContext().  

Do you have nested editingContexts?  If you don't then that would seem to be 
why your code is failing.

I hope this sheds some light on what's going on.
Mark
__
Mark Ritchie
Diamond Lake Consulting Inc., Toronto Ontario Canada.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to