Re: newEO.localInstanceIn(localEditingContext)
Re: newEO.localInstanceIn(localEditingContext)
- Subject: Re: newEO.localInstanceIn(localEditingContext)
- From: Chuck Hill <email@hidden>
- Date: Thu, 26 Mar 2009 13:21:27 -0700
On Mar 26, 2009, at 1:10 PM, David LeBer wrote:
On 26-Mar-09, at 3:16 PM, Ricardo J. Parada wrote:
Hi All,
If I have an EO that has not been saved to the database (i.e.
newFoo in my code below), is it possible to do the following:
Foo localFoo = newEO.localInstanceIn(localEditingContext());
Normally I get the error:
java.lang.IllegalStateException: You attempted to localInstance
<com.model.Foo pk:"null">, which has not yet committed.
But I think that it should be allowed, even if that requires that I
get a primary key for localFoo.
Does anybody know if that can be accomplished??
By not doing that. :-)
This is the trickiest part of working with multiple EOs.
The rules:
• You cannot relate EOs in different ECs
• You cannot move uncommitted (new) EOs between ECs
There is one exception: parent and children ECs. You can move the new
EO into a child EC (IIRC).
Chuck
So when you create EOs you have to do so in the EC that is going to
save them, and if you need to relate new EOs to existing ones, it's
the existing ones that need to move.
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
twitter: http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
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
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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