Originally posted by Ali Gohar:
Yes you are right setRollbackOnly is the method of UserTransaction, but EJB Specification mandates that you should not use setRollbackOnly for BMT if you will do so you will get an exception.
The reason that you don't have this method for BMT is because you have full control over transaction in BMT and you can simply rollback whenever you need.
Are you sure about that ?
I quote HFEJB : "But if somewhere earlier in your code you can tell that the transaction is doomed, you should call setRollbackOnly()"
18.104.22.168 getRollbackOnly and setRollbackOnly Methods
An enterprise bean with bean-managed transaction demarcation must not use the getRollbackOnly
and setRollbackOnly methods of the EJBContext interface.
An enterprise bean with bean-managed transaction demarcation has no need to use these methods,
because of the following reasons:
� An enterprise bean with bean-managed transaction demarcation can obtain the status of a
transaction by using the getStatus method of the javax.transaction.User-
� An enterprise bean with bean-managed transaction demarcation can rollback a transaction
using the rollback method of the javax.transaction.UserTransaction interface.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koophttps://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton