cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Øyvind Harboe" <oyvind.har...@zylin.com>
Subject DataContext.localObject() on uncommitted objects
Date Wed, 19 Jul 2006 15:55:51 GMT
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

Mime
View raw message