rollbackChanges and toMany lists

From: Mike Kienenberger (mkienen..laska.net)
Date: Thu Sep 09 2004 - 14:11:09 EDT

  • Next message: Andrus Adamchik: "Re: rollbackChanges and toMany lists"

    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("UserAccountRelationship");
      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 - 14:10:17 EDT