Re: exception in ContextCommit

From: Bryan Lewis (brya..aine.rr.com)
Date: Fri Oct 15 2004 - 18:25:31 EDT

  • Next message: Eric Schneider: "DataContext.createDataContext(boolean useSharedCache)"

    Okay, I created CAY-213 with an attached test case that reproduces the
    bug. Good luck and thanks!

    Andrus Adamchik wrote:
    > Hi Bryan,
    >
    > ObjectStore.retainedSnapshotMap should keep snapshots of all modified
    > uncommitted objects. If this is not the case, I'd really like to track
    > down the reason. Doing "getSnapshot()" instead of
    > "getRetainedSnapshot()" should actually be OK as a temp workaround, but
    > not as a permanent fix, as cross-context synchronization consistency
    > will be affected.
    >
    > Could you please open a bug report with your findings? If you have a
    > code example to reproduce the problem, please attach it to the report -
    > this would be awesome.
    >
    > Thanks
    > Andrus
    >
    >
    > On Oct 14, 2004, at 12:16 PM, Bryan Lewis wrote:
    >
    >> I'm getting a NullPointerException in version 1.1-RC1.
    >>
    >> org.objectstyle.cayenne.access.ContextCommit.appendOptimisticLockingAtt
    >> ributes(ContextCommit.java:564)
    >> org.objectstyle.cayenne.access.ContextCommit.prepareUpdateQueries(Conte
    >> xtCommit.java:426)
    >> org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:
    >> 156)
    >> org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.ja
    >> va:1231)
    >> org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.ja
    >> va:1201)
    >>
    >> I've stepped through the code; the snapshot being retrieved at line
    >> 556 is null, causing the exception a few lines later in
    >> snapshot.get(name).
    >>
    >> The DataObject is a normal object with state = modified; a new object
    >> is being added to its to-many relationship. There's only one
    >> DataContext in use. If I tell the Modeler not to use optimistic
    >> locking for the modified object, the exception doesn't happen because
    >> appendOptimisticLockingAttributes() isn't called.
    >>
    >> I copied the snapshot-getting line 556 to my own code for an experiment.
    >> If I replace getRetainedSnapshot() with getSnapshot(objectId,
    >> dataContext), a non-null snapshot is returned. That might not be the
    >> right solution... I just wanted to confirm that the null result was
    >> coming from getRetainedSnapshot().
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Oct 15 2004 - 18:25:50 EDT