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

Difference between rollback() & setRollbackOnly()

 
Malan Subramanian
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
Is there any difference between the following methods in javax.transation.UserTransaction

and


Thanks in advance,
Malan
 
Prabhu Venkatachalam
Ranch Hand
Posts: 502
Java jQuery Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setRollbackOnly() - can be called for CMT(container managed transaction)& BMT (Bean managed transaction) beans

rollback() - can be called only for BMT beans.


hth,
 
Rajan Murugan
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In CMT javax.Transaction.UserTransaction interface methods do not play any role.In CMT EJBContext.setRollbackOnly() plays the same role.

Both the said methods setRollbackOnly and rollback() of UserTransaction is for BMT beans.

One is used to rollback straightaway.(rollback())
Another one is to mark the transaction as doomed.Even if it is doomed the transaction will continue to the end.But will be rolledback.(setRollBack()).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic