Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-237

RollBack flattened inserts

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1 [LEGACY]
    • 1.1 [LEGACY]
    • Core Library
    • None
    • Windows 2000, Tomcat 5.0.x and JDK 1.4.x

    Description

      I've got the entities Smartcard and Product, and a flattened relatioship between them, listPreloadProducts.
      The problem arises when I create a new Smartcard with some Products and an error happens during the creation.
      For example a Unique Index constraint is broken. At this moment a CayenneRuntimeException is thrown, I catch the Exception and I do a DataContext.rollbackChanges().
      After this, I can't do any insert, I've got always a CayenneRuntimeException.

      Trying to find the source of the exception I've realised that DataContext.rollbackChanges() doesn't delete the flattenedInserts List in the ObjectStore.
      This means there is a FlattenedRelationshipInfo Object in the List where the DataObject source is TRANSIENT.
      So next time I try todo commit,this flattenedInserts List is iterated in ContextCommit.categorizeFlattenedInsertsAndCreateBatches().
      In this iteration is only checked if any DataObject in the relationship is DELETED. So the FlattenedRelationshipInfo is tried to be inserted and an error happens.

      Here it is the exception stack trace

      java.lang.NullPointerException at org.objectstyle.cayenne.access.FlattenedRelationshipInfo.buildJoinSnapshot(FlattenedRelationshipInfo.java:214)
      at org.objectstyle.cayenne.access.FlattenedRelationshipInfo.buildJoinSnapshotForInsert(FlattenedRelationshipInfo.java:239)
      at org.objectstyle.cayenne.access.ContextCommit.categorizeFlattenedInsertsAndCreateBatches(ContextCommit.java:720)

      at org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:143)

      at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1231)

      at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1201)

      at KeyFlyManager.Persistence.AccessDB.commit(AccessDB.java:104)

      Attachments

        Activity

          People

            andrus Andrus Adamchik
            jsopena Jorge Sopena
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: