DataContext.localObject() on uncommitted objects

From: Øyvind Harboe (oyvind.harbo..ylin.com)
Date: Wed Jul 19 2006 - 11:55:51 EDT

  • Next message: Andrus Adamchik: "Re: DataContext.localObject() on uncommitted objects"

    Is it supported to pass an ObjectId for an uncommitted
    CayenneDataObject (i.e. where getObjectId().isTemproary()==true) to
    DataContext.localObject()?

    The reason I ask, is that I'm struggling with the exception below.

    The scenario as best as I can tell is:

    - Create a new CayenneDataObject
    - Create a child context
    - Transfer the newly created CayenneObject to the childcontext using
    DataContext.localObject() (I haven't tried creating the
    CayenneDataObject in the child)
    - modify the CayenneDataObject in the child context
    - commitToParent on the child context
    - At this point I create a new child datacontext and transfer the same
    CayenneDataObject to the child using localObject()
    - At this point the readProperty() on the object causes the exception below

    org.objectstyle.cayenne.CayenneRuntimeException
    Temporary id can't be used in RelationshipQuery: <ObjectId:TreatCost,
    TEMP:000000791D3C010B>
    unlabeledMessage: Temporary id can't be used in RelationshipQuery:
    <ObjectId:TreatCost, TEMP:000000791D3C010B>
    Stack Trace:

        * org.objectstyle.cayenne.query.RelationshipQuery.<init>(RelationshipQuery.java:112)
        * org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.doResolveFault(DataContextFaults.java:139)
        * org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.resolveFault(DataContextFaults.java:117)
        * org.objectstyle.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:245)

    -- 
    Øyvind Harboe
    http://www.zylin.com
    



    This archive was generated by hypermail 2.0.0 : Wed Jul 19 2006 - 11:56:16 EDT