Re: rollbackChanges and toMany lists

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Sep 09 2004 - 16:23:20 EDT

  • Next message: Andrus Adamchik: "Re: Cayenne and Naked Objects"

    Let me try to test it and see if it is a bug.

    On Sep 9, 2004, at 2:11 PM, Mike Kienenberger wrote:
    > Andrus,
    >
    > I'm still confused why a toMany list is wrong after a rollback.
    > Currently, I have to do a rollback followed by invalidateObjects for
    > aUser
    > to remove the transient object in my
    > aUser.getUserAccountRelationshipList()
    > list.
    >
    > -Mike
    >
    > // simplified code snippet:
    >
    > UserAccountRelationship newUserAccountRelationshipObject =
    > (UserAccountRelationship)aDataContext.createAndRegisterNewObject("UserA
    > ccountRelationship");
    > aUserAccountRelationship.setUserObject(aUser);
    >
    > try
    > {
    > aDataContext.commitChanges();
    > }
    > catch (CayenneRuntimeException aCayenneRuntimeException)
    > {
    > aDataContext.rollbackChanges();
    >
    > // seemingly unnecessary invalidateObjects() call
    > aDataContext.invalidateObjects(Collections.singletonList(aUser));
    >
    > // rest of error handling
    > }
    >



    This archive was generated by hypermail 2.0.0 : Thu Sep 09 2004 - 16:23:26 EDT