• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Difference between rollback() & setRollbackOnly()

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


Thanks in advance,
Ranch Hand
Posts: 502
jQuery Spring Java
  • 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.

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()).
Their achilles heel is the noogie! Give them noogies tiny ad!
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic