Problems rolling back flattened inserts

From: Jorge Sopena (
Date: Wed Nov 10 2004 - 09:21:46 EST

  • Next message: Andreas Pardeike: "Paging through data"

    Hello all,

    Maybe someone had found this problem before, but I didn't see any post
    about it.
    I explain the situation:

    I've got the entities Smartcard and Product, and a flattened
    relationship 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
    After this, I can't do any insert, I've got always a

    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 to do 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.

    Is this a known bug? I'm missing something?


    Jorge Sopena

    This archive was generated by hypermail 2.0.0 : Wed Nov 10 2004 - 09:04:49 EST