cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Øyvind Harboe" <>
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

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

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

    * org.objectstyle.cayenne.query.RelationshipQuery.<init>(
    * org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.doResolveFault(
    * org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.resolveFault(
    * org.objectstyle.cayenne.CayenneDataObject.readProperty(

Øyvind Harboe

View raw message