Announcement Announcement Module
No announcement yet.
GlobalRollback inside nested transactions Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • GlobalRollback inside nested transactions


    When 'setGlobalRollbackOnParticipationFailure' of my TransactionManager is set to the default of 'true' a nested transaction (PROPAGATION_NESTED) will affect the outer transaction. This isn't what I expect but I can't tell if it is the correct behaviour or not.

    My scenario is similar to the example described by JH in (parsing a large input file)

    The main difference is that my nested transaction calls code that uses other supporting transactions. As soon as one of these inner-most transactions fails the whole lot gets rolled back. All of the exception handling seems to be done in the correct place as even if one nested transactions fails the outer transaction continues with no problem - it just rolls back when it finishes!

    If I disable global rollbacks everything works fine but I don't like changing the default in case it does affect something else.

    Any help appreciated :-)

  • #2
    As explained here :

    If "setGlobalRollbackOnParticipationFailure" is "true", "the transaction will be globally marked as rollback-only. The only possible outcome of such a transaction is a rollback: The transaction originator cannot make the transaction commit anymore."

    So that seems a perfectly correct behavior to me.


    • #3
      In the same comment below it mentions that..

      "The recommended solution for handling failure of a subtransaction is a "nested transaction", where the global transaction can be rolled back to a savepoint taken at the beginning of the subtransaction."

      I had hoped that any inner transaction of the nested transaction would only affect this nested transaction.

      Since this isn't the case, the nested transaction just becomes a normal supporting transaction -- ie. savepoints only work if there are no further inner transactions. Have I understood this correctly?