Description
Code describing the problem:
CayenneContext context = cayenneService.getContext();
Artist a = context.newObject(Artist.class);
a.setArtistName("a");
ObjectContext child = context.createChildContext();
Painting p = child.newObject(Painting.class);
p.setPaintingTitle("p");
p.setToArtist(child.localObject(a));
child.commitChangesToParent();
p.getToGallery(); // this will throw an exception
On the last line following exception will be thrown:
org.apache.cayenne.CayenneRuntimeException: [v.3.1M4-SNAPSHOT Jun 15 2012 06:55:01] Can't build a query for relationship 'gallery' for temporary id: <ObjectId:Painting, TEMP:000001CA37BA0001>
at org.apache.cayenne.query.RelationshipQuery.createReplacementQuery(RelationshipQuery.java:113)
at org.apache.cayenne.query.IndirectQuery.getReplacementQuery(IndirectQuery.java:103)
at org.apache.cayenne.query.IndirectQuery.route(IndirectQuery.java:86)
at org.apache.cayenne.access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:424)
....................
Persistence state of artist and painting objects by that moment will be COMMITTED.
Attachments
Attachments
Issue Links
- is related to
-
CAY-1183 commitToParent() makes object persistence state committed, produces exception when using object in parent context (ROP)
- Closed