nested contexts

From: Marcin Skladaniec (marci..sh.com.au)
Date: Tue Jan 13 2009 - 00:30:04 EST

  • Next message: Andrus Adamchik: "Re: nested contexts"

    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



    This archive was generated by hypermail 2.0.0 : Tue Jan 13 2009 - 00:30:50 EST