Feb 9th, 2012, 03:19 PM
Understanding @Transactional rollbackFor and transaction demarcation
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?
Last edited by aanno; Feb 10th, 2012 at 02:05 AM.