Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

UserTransaction rollback method pair

 
Michael Kosowski
Greenhorn
Posts: 7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the practical difference in UserTransaction object between methods below?

rollback() - Roll back the transaction associated with the current thread.
setRollbackOnly() - Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.

This description is not enough for me. Does it mean that rollback method throws exception immediately or what?
 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may find this article helpful at : http://www.developerscrappad.com/547/java/java-ee/ejb3-x-jpa-when-to-use-rollback-and-setrollbackonly/

With UserTransaction in BMT, Oracle does not recommend you to call setRollbackOnly() method even though it compiles.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic