Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
3.0M5
-
None
-
ROP (maybe also 2t cayenne, I have not tried)
Description
This is a bit of pseudocode showing the problem
Artist artist = parentContext.perfrormQuery(new SelectQuery(Artist.class)).get(0);
CayenneContext childContext = parentContext.createChildContext();
Painting painting = childContext.newObject(Painting.class);
painting.setArtist(artist);
painting.setBlah...
childContext.commitToParent();
for(Painting p : artist.getPaintings())
logger.debug("painting persistence state : "+PersistenceState.persistenceStateName(p.getPersistenceState())); //all objects are in state COMMITTED
this causes no problems so far, but if one now decides to
p.getSomeRelatiohship();
an exception will be raised, because the relationship has not been faulted yet:
[java] Caused by: java.lang.Exception: [v.3.0-SNAPSHOT ${project.build.date} ${project.build.time}] Can't build a query for relationship 'someRelationship' for temporary id: <ObjectId:Painting, TEMP:00000160F3600029>
[java] at org.apache.cayenne.remote.service.BaseRemoteService.processMessage(BaseRemoteService.java:160)
... 25 more
Attachments
Issue Links
- relates to
-
CAY-1714 ROP: Cayenne tries to build a query for non committed object when using more than 2 nested contexts
- Closed