Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring/Hibernate/Arjuna: Commit inner tx, rollback outer tx on RuntimeException

Stephan Mueller
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic