Re: Bug in nested DataContext?

From: Michael Gentry (blacknex..mail.com)
Date: Thu Oct 04 2007 - 14:03:18 EDT

  • Next message: Michael Gentry (JIRA): "[JIRA] Created: (CAY-872) Potential bug deleting uncommited objects from a nested DataContext"

    Well, I have a little bit of a test harness that produces the
    exception. I'll try to package it up later if anyone else would like
    to look at it.

    Thanks,

    /dev/mrg

    On 10/4/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    > Looks like a bug. In any event probably worth investigating.
    >
    > Andrus
    >
    >
    > On Oct 4, 2007, at 7:06 PM, Michael Gentry wrote:
    >
    > > I have a nested DataContext:
    > >
    > > DataContext childContext = parentContext.createChildDataContext();
    > >
    > > I have a Master and 3 Details (1-to-many) in the parent DC (in a
    > > committed state), and pull the Master into the nested DC using
    > > localObject(). If I then do the following:
    > >
    > > Master childMaster = (Master)
    > > childContext.localObject(parentMaster.getObjectId(), null);
    > >
    > > Detail d = (Detail) childContext.newObject(Detail.class);
    > > d.setXXXXXXXX(...); // do sets
    > > childMaster.addToDetails(d);
    > >
    > > childContext.commitChangesToParent();
    > >
    > > childContext.deleteObject(d);
    > > childMaster.removeFromDetails(d);
    > > childContext.commitChangesToParent();
    > >
    > > I get an exception on the last commitChangesToParent():
    > >
    > > Exception in thread "main" org.apache.cayenne.CayenneRuntimeException:
    > > [v.3.0M1 Jul 16 2007 22:25:33] Can't build a query for temporary id:
    > > <ObjectId:Detail, TEMP:000004B078EB2838>
    > >
    > > Is this to be expected? If I change commitChangesToParent() to
    > > commitChanges() it works ...
    > >
    > > Thanks,
    > >
    > > /dev/mrg
    > >
    >
    >



    This archive was generated by hypermail 2.0.0 : Thu Oct 04 2007 - 14:04:02 EDT