Edgar,

Here is an example illustrating your efforts to translate a newly inserted EO from one EC to another:

Agent 1: This is a newly created EO (NOT SAVED):
{values = {middleName = <com.webobjects.foundation.NSKeyValueCoding$Null>; lastName = <com.webobjects.foundation.NSKeyValueCoding$Null>; addresses = (); entryTimestamp = 2006-07-24 14:02:12 Etc/GMT; drivers = (); companyNumber = <com.webobjects.foundation.NSKeyValueCoding$Null>; emails = (); phones = (); terminalCode = <com.webobjects.foundation.NSKeyValueCoding$Null>; firstName = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<Agent 4bc336 <EOTemporaryGlobalID: 0 0 10 1 21 -32 0 0 -39 3 1 0 0 0 1 12 -96 -41 -52 31 11 32 117 94>>"; }

Existing Agent: This is an existing EO fetched from databases:
{values = {middleName = <com.webobjects.foundation.NSKeyValueCoding$Null>; lastName = <com.webobjects.foundation.NSKeyValueCoding$Null>; addresses = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 3cfd6e (<EOAccessArrayFaultHandler addresses _EOIntegralKeyGlobalID[Agent (java.lang.Integer)3295]>)>"; entryTimestamp = 2004-06-29 21:40:01 Etc/GMT; drivers = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 42e40c (<EOAccessArrayFaultHandler drivers _EOIntegralKeyGlobalID[Agent (java.lang.Integer)3295]>)>"; companyNumber = 2; emails = "<com.webobjects.eocontrol._EOCheapCopyMutableArray 9220cb (<EOAccessArrayFaultHandler emails _EOIntegralKeyGlobalID[Agent (java.lang.Integer)3295]>)>"; phones = "<com.webobjects.eocontrol._EOCheapCopyMutableArray e50215 (<EOAccessArrayFaultHandler phones _EOIntegralKeyGlobalID[Agent (java.lang.Integer)3295]>)>"; terminalCode = "AAA"; firstName = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<Agent bb8077 _EOIntegralKeyGlobalID[Agent (java.lang.Integer)3295]>"; }

Agent 2: This is another new EO created using:
Agent anAgent2 = (Agent)ec2.faultForGlobalID(ec1.globalIDForObject(anAgent1), ec2);
null

Notice the difference above between the EOGlobalID's of the newly inserted EO and the existing EO fetched from the database.  EOTemporaryGlobalID cannot be used to translate an EO from one EOEditingContext to another.  Notice that the result is <null> rather than a new fault object representing an EO.

On Jul 24, 2006, at 8:37 AM, Ken Anderson wrote:

Edgar,

If you do ec.deleteObject(obj) and it has never been saved, it will just be removed.

Care to share why you want to process this way?

Ken

On Jul 24, 2006, at 7:43 AM, Edgar Ra. Klein wrote:

Hi,

I'm writing an application to import data from files and have a problem inserting an EOEnterpriseObject from an unsaved editing context into another one. More precisely, I have an EOEnterpriseObject inserted into an editing context ec1. After some processing this object isn't complete to be saved, hence I wanted to remove it from ec1, insert it into another editing context ec2, and try to update the reference later.

I already tried to remove the object from ec1 by using the following code:
- ec1.forgetObject(eoObject); (I know, I should not invoke this method, but this approach doesn't work anyway)
The problem here is that there is still a null object in the editing context ec1.

Is there a possibility to unregister a newly generated object (not saved in the database) from its current editing context (this editing context should be empty, if this object was the only object) and to insert it into another one?

Thanx,
Edgar
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:

This email sent to [EMAIL PROTECTED]

--
Robert Walker



 _______________________________________________
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