Spring/Hibernate/Arjuna: Commit inner tx, rollback outer tx on RuntimeException
posted 3 years ago
Hi. We are using Hibernate with the Arjuna JTA Manager and Springs Transactional support (annotation etc)
Imagine the following scenario
The expectation is, that in case of a RTE in the outer TX, the "important stuff" in the new TX is done and committed.
But what happens is, that the RTE from the outer TX seems to implicitely set a globalRollback Flag (basic handling of RTEs in this transaction scenario?). Now when the new TX (with the important stuff) tries to commit, Springs AbstractPlatformTransactionManager throws an exception like "Transaction silently rolled back because it was marked rollback only". Sorry, don't have exact Stacktrace here atm. I can post it tomorrow.
My question is: what is the exact reason for this behaviour? How can I circumvent it? Is the RTE really the problem here? Is the basic assumption, that the new TX can commit while the outer TX rolls back, correct or is it plain stupid?
Additionally let's assume, I can't change the expected transaction type to a checked exception
Looking forward to read your thoughts on this
1. Make it run - 2. Make it run correctly - 3. Make it pretty OR fast/small - 4. ??? - 5. Profit