• 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: 1400
8
  • 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.

 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!