Re: How to selectively save EO
Re: How to selectively save EO
- Subject: Re: How to selectively save EO
- From: Ken Anderson <email@hidden>
- Date: Fri, 21 Apr 2006 07:52:43 -0400
Louis,
First off, please start a new message instead of replying to an old
message and changing the subject. It messes up people organizing
their email by thread.
On Apr 21, 2006, at 12:19 AM, Louis Demers wrote:
Hi
I would like to save newly created EO immediately but there could
be other objects in the default EditingContext which I do not want
to commit to the database immediately.
My first attempt was to create a new short term EditignContext,
insert my newly created EO in it and call saveChanges.
However because this object has a relationsip to another one in
the defaultEditingContext, it cause an error about being unable to
obtain globalId
You need to move the object in the default editing context over to
the new editing context. A golden rule is that all related objects
have to be in the same editing context. There is a convenience
static method in the EOUtilities class called localInstanceOfObject.
You pass it the editing context you want the object in, as well as
the object, and it will return a new instance in the desired editing
context.
Obviously, if the EO you want to relate to is new and unsaved, this
won't work.
Ken
Any suggestions how to acheive this ?
--
Louis Demers ing.
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com
This email sent to email@hidden
_______________________________________________
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