aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Bean things that can be done in BMT Vs CMT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Bean things that can be done in BMT Vs CMT" Watch "Bean things that can be done in BMT Vs CMT" New topic
Author

Bean things that can be done in BMT Vs CMT

Srinivas Modekurti
Greenhorn

Joined: Nov 15, 2004
Posts: 9
I am a little curious to know about the bean things that we can do in BMT and CMT demarcations for a stateful session bean.

The thing which is confusing to me is that for a BMT on a stateful session bean, I cannot do sessionCtx.geRollbackonly() andsetRollbackOnly inside an ejbCreate() method. Whereas if I use BMT, I am allowed to get an UserTransaction and call methods on it like getRollbackOnly() in the same ejbCreate() method.

Would appreciate if anyone can throw some light on it....


Srinivas Modekurti<br />Systems Engineer<br />Walgreens Co
Vagner Freitas
Ranch Hand

Joined: Aug 02, 2004
Posts: 85
Hi Srinivas,

CMT session bean method ejbCreate() is not considered part of client's transaction, then it run in an "unspecified transaction context". Becouse this, the nethods EJBContext.setRollbackOnly() and EJBContext.getRollbackOnly() can't be called in ejbCreate().
But for BMT session bean the bean provider manages the transaction, and then it is possible get UserTransaction and call methods on it in ejbCreate(), like begin(), commit(), getStatus(), rollback(), setRollbackOnly() and setTransactionTimeout().
I hope this helps you.

Vagner


SCJA, SCJP, SCBCD & SCEA (Part I)
Srinivas Modekurti
Greenhorn

Joined: Nov 15, 2004
Posts: 9
Thank you very much. Things are now clear to me.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Bean things that can be done in BMT Vs CMT