Results 1 to 1 of 1

Thread: Understanding @Transactional rollbackFor and transaction demarcation

  1. #1
    Join Date
    Feb 2012
    Posts
    5

    Default Understanding @Transactional rollbackFor and transaction demarcation

    Hello,

    I suppose the following stacktrace as java invocation:

    B.method2 (annotated with a plain @Transactional)
    A.method1 (annotated with a plain @Transactional)
    Main.main (starting point of the call, with no current transaction)

    I expect that a transaction is started when A.method1 is entered - and the transaction will be commited (or rolled back) when A.method1 is left. I also expect that the same transaction will be used within B.method2.

    A RuntimeException is thrown from within B.method2. This is a Exception that is 'listed' for rollbackFor by default. The Exception is catched within A.method1, but it will pass the boundary of @Transactional when leaving B.method2.

    This is my question: Will the (current) transaction be marked for rollback or not?

    Cheers,

    aanno
    Last edited by aanno; Feb 10th, 2012 at 02:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •