aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes EJB 2 BMT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB 2 BMT " Watch "EJB 2 BMT " New topic
Author

EJB 2 BMT

Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Hi all, I encountered a strange situation where the container was calling setRollbackOnly() after a runtime exception.(Okay I know that doesn't sound so strange)BUTwhat's confusing me is that the BMT method was not called from and did not start any transactions....So what happened was the method threw a runtime exception and then the container called setRollbackOnly().That's all well and good but what does that mean??If no transaction was started then what is it rolling back?


===>SCJP 1.5(72%)<===
==>SCWCD1.5(76%)<===
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


So what happened was the method threw a runtime exception and then the container called setRollbackOnly().That's all well and good but what does that mean??If no transaction was started then what is it rolling back?

That does sounds wierd. Its BMT, the bean is supposed to be managing the transaction so setRollbackOnly should not need to be called.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

Yes...Maybe it's something specific that WAS 6 does??Because I'm pretty sure if I call setRollbackOnly() when there is no transaction I will get an IllegalStateException...
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

It will do, if you are using CMT. But you are not.
Duran Harris
Ranch Hand

Joined: Nov 09, 2008
Posts: 598

So this is different from EJB 3.0?Here's an excerpt from EJB3.0 core specs:

13.3.3.1 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-
Transaction interface.
� An enterprise bean with bean-managed transaction demarcation can rollback a transaction
using the rollback method of the javax.transaction.UserTransaction interface.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: EJB 2 BMT