I can confirm - it's a bug. I just fixed it on 1.2 branch; will
commit the fix to HEAD shortly.
http://issues.apache.org/cayenne/browse/CAY-601
Andrus
On Jul 19, 2006, at 11:55 AM, Øyvind Harboe wrote:
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