This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Difference between rollback() & setRollbackOnly() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Difference between rollback() & setRollbackOnly()" Watch "Difference between rollback() & setRollbackOnly()" New topic
Author

Difference between rollback() & setRollbackOnly()

Malan Subramanian
Greenhorn

Joined: Jul 09, 2005
Posts: 13
Hi Ranchers,
Is there any difference between the following methods in javax.transation.UserTransaction

and


Thanks in advance,
Malan
Prabhu Venkatachalam
Ranch Hand

Joined: Nov 16, 2005
Posts: 502

setRollbackOnly() - can be called for CMT(container managed transaction)& BMT (Bean managed transaction) beans

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


hth,


Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
Rajan Murugan
Ranch Hand

Joined: Jun 24, 2006
Posts: 182
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()).


With Regards,<br /> Rajan<br />"Java Rocks"
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Difference between rollback() & setRollbackOnly()