You can't localInstanceOfObject a new object (one that has not been committed yet).  There's no snapshot yet, so it would have odd side-effects if they allowed you to do so (it would mean that when you save both editing contexts, it would commit twice, i would assume).  Not sure if old versions of EOF let you, but it's been this way for a while.

ms

On May 31, 2006, at 4:09 PM, Kieran Kelleher wrote:

I think I am losing my mind.... 

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?!

<snip>
    public void setJob( CTJob job ) {
        if ( log.isDebugEnabled() ) log.debug("Setting job from " 
                                              + ( _job == null ? "null" : _job.toLongString() )
                                              + " to " 
                                              + ( job == null ? "null" : job.toLongString() ) );
        
        if ( log.isDebugEnabled() ) log.debug("job.editingContext() = " + WKStringUtilities.toString( job.editingContext() ) );
        
        if ( !job.editingContext().equals( defaultEditingContext() ) ) {
            defaultEditingContext().lock();
            try {
                if ( log.isDebugEnabled() ) log.debug("defaultEditingContext() = " + WKStringUtilities.toString( defaultEditingContext() ) );
                if ( log.isDebugEnabled() ) log.debug("job = " + ( job == null ? "null" : job.toLongString() ) );
                
                _job = (CTJob)EOUtilities.localInstanceOfObject( defaultEditingContext(), job );
                
                if ( log.isDebugEnabled() ) log.debug("Made local copy of job = " + ( _job == null ? "null" : _job.toLongString() ) );
            } finally {
                defaultEditingContext().unlock();
            }
        } else {
            _job = job;
        }
    }
</snip>

gives log output like this:

<snip>
165677 DEBUG [PdX752d1r3lPfb0FXMB9f0kieranWorkerThread5] (JobMessageRelateAndSaveLRTask, setJob, 24) -
Setting job from null to {values = {productionDispatchDate = 2006-06-01 04:00:00 Etc/GMT; inheritanceType = 10; product = "<CTProduct 356844 _EOIntegralKeyGlobalID[CTProduct (java.lang.Integer)1]>"; shipDate = 2006-06-03 04:00:00 Etc/GMT; messages = (); descriptor = "asasdasdasda"; workflowState = "setup"; jobCode = <com.webobjects.foundation.NSKeyValueCoding$Null>; recAddUser = <com.webobjects.foundation.NSKeyValueCoding$Null>; recModUser = <com.webobjects.foundation.NSKeyValueCoding$Null>; recAddTime = <com.webobjects.foundation.NSKeyValueCoding$Null>; recModTime = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<CTSmartMixJob 5ee1b2 <EOTemporaryGlobalID: 0 0 -64 -88 1 6 0 0 -53 72 1 0 0 0 1 11 -116 8 -112 61 41 -14 -31 105>>"; }

165680 DEBUG [PdX752d1r3lPfb0FXMB9f0kieranWorkerThread5] (JobMessageRelateAndSaveLRTask, setJob, 29) -
job.editingContext() = [EMAIL PROTECTED]

165682 DEBUG [PdX752d1r3lPfb0FXMB9f0kieranWorkerThread5] (JobMessageRelateAndSaveLRTask, setJob, 34) -
defaultEditingContext() = [EMAIL PROTECTED]

165686 DEBUG [PdX752d1r3lPfb0FXMB9f0kieranWorkerThread5] (JobMessageRelateAndSaveLRTask, setJob, 35) -
job = {values = {productionDispatchDate = 2006-06-01 04:00:00 Etc/GMT; inheritanceType = 10; product = "<CTProduct 356844 _EOIntegralKeyGlobalID[CTProduct (java.lang.Integer)1]>"; shipDate = 2006-06-03 04:00:00 Etc/GMT; messages = (); descriptor = "asasdasdasda"; workflowState = "setup"; jobCode = <com.webobjects.foundation.NSKeyValueCoding$Null>; recAddUser = <com.webobjects.foundation.NSKeyValueCoding$Null>; recModUser = <com.webobjects.foundation.NSKeyValueCoding$Null>; recAddTime = <com.webobjects.foundation.NSKeyValueCoding$Null>; recModTime = <com.webobjects.foundation.NSKeyValueCoding$Null>; }; this = "<CTSmartMixJob 5ee1b2 <EOTemporaryGlobalID: 0 0 -64 -88 1 6 0 0 -53 72 1 0 0 0 1 11 -116 8 -112 61 41 -14 -31 105>>"; }

165687 DEBUG [PdX752d1r3lPfb0FXMB9f0kieranWorkerThread5] (JobMessageRelateAndSaveLRTask, setJob, 39) -
Made local copy of job = null
</snip>

I make local instances of new objects in other places with no issues ..... usually 99.9% of problems are of my own doing, but this one is baffling me. Is this a bug introduced in 5.3.1 when they fixed radar 4240473?

-Kieran
________________________________________________________________
Dev Config = OS X 10.4.5 i686-C.Duo / Java 1.4.2_09 /  WO 5.3.1 & P. Wonder / XCode v2.2.1 / MySQL 4.1.18-std / Connector-J 3.0.17
Deploy Config = OS X 10.3.9 Server G4-PPC / Java 1.4.2_09 / WO 5.2.3 / MySQL 4.0.26 / Connector-J 3.0.17





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
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      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to archive@mail-archive.com

Reply via email to