[OS-JIRA] Created: (CAY-237) RollBack flattened inserts

From: jir..bjectstyle.org
Date: Fri Nov 12 2004 - 09:47:47 EST

  • Next message: Gentry, Michael: "RE: [OS-JIRA] Created: (CAY-236) gui application generates malformed xml"

    Message:

      A new issue has been created in JIRA.

    ---------------------------------------------------------------------
    View the issue:

      http://objectstyle.org/jira/secure/ViewIssue.jspa?key=CAY-237

    Here is an overview of the issue:
    ---------------------------------------------------------------------
            Key: CAY-237
        Summary: RollBack flattened inserts
           Type: Bug

         Status: Assigned
       Priority: Major

        Project: Cayenne
     Components:
                 Cayenne Core Library
       Versions:
                 1.1

       Assignee: Andrus Adamchik
       Reporter: Jorge Sopena

        Created: Fri, 12 Nov 2004 9:45 AM
        Updated: Fri, 12 Nov 2004 9:45 AM
    Environment: 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)

    ---------------------------------------------------------------------
    JIRA INFORMATION:
    This message is automatically generated by JIRA.

    If you think it was sent incorrectly contact one of the administrators:
       http://objectstyle.org/jira/secure/Administrators.jspa

    If you want more information on JIRA, or have a bug to report see:
       http://www.atlassian.com/software/jira



    This archive was generated by hypermail 2.0.0 : Fri Nov 12 2004 - 09:47:51 EST