Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UserTransaction rollback method pair  RSS feed

 
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: 1509
9
  • 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
Boost this thread!