Re: Strange localInstanceOfObject behaviour...
Re: Strange localInstanceOfObject behaviour...
- Subject: Re: Strange localInstanceOfObject behaviour...
- From: Mark Ritchie <email@hidden>
- Date: Wed, 31 May 2006 17:35:27 -0400
On Wednesday, May 31, 2006, at 04:24PM, Kieran Kelleher <email@hidden> 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@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden