Re: Problems rolling back flattened inserts

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Fri Nov 12 2004 - 09:23:01 EST

  • Next message: Giulio Cesare Solaroli: "(Almost) SOLVED Re: Parametric queries stored in DataMap"

    I don't think we have a bug report for this. Could you please create one.
    When you do that could you please post the stacks of all thrown
    exceptions.

    Thanks
    Andrus

    > Hello all,
    >
    > Maybe someone had found this problema before, but I didn't see any post
    > about it.
    > I explain the sistuation:
    >
    > 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 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?
    >
    > Thanks,
    >
    > Jorge Sopena



    This archive was generated by hypermail 2.0.0 : Fri Nov 12 2004 - 09:23:03 EST