cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marcin Skladaniec" <mar...@ish.com.au>
Subject nested contexts
Date Tue, 13 Jan 2009 05:30:04 GMT
Hi

I have tried to use the nested contexts today. I tried a 
very simple thing, creating two objects one in the parent 
one in the child context, then linking them together:

ObjectContext aContext = ContextManager.getNewContext();
ObjectContext childContext = 
aContext.createChildContext();

Site site = aContext.newObject(Site.class);
Room room = childContext.newObject(Room.class);

r.setSite(s);


the last line throws exception:
  [java] org.apache.cayenne.CayenneRuntimeException: 
[v.3.0-SNAPSHOT ${project.build.date} 
${project.build.time}] Cannot set object as destination of 
relationship site because it is in a different 
ObjectContext
      [java] 	at 
org.apache.cayenne.CayenneDataObject.willConnect(CayenneDataObject.java:338)
      [java] 	at 
org.apache.cayenne.CayenneDataObject.setToOneTarget(CayenneDataObject.java:292)
      [java] 	at 
ish.oncourse.server.cayenne.glue._Room.setSite(_Room.java:135)
...rest of stack trace is not important

I think it is a bug, and relating objects should be 
allowed between parent/child contexts.

Another thing is that the 
http://cayenne.apache.org/doc/nested-datacontexts.html 
states that nested contexts are not available in ROP, is 
that still?

All best
Marcin

Mime
View raw message