This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes HFEJB doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "HFEJB doubt" Watch "HFEJB doubt" New topic
Author

HFEJB doubt

nik rb
Greenhorn

Joined: Sep 25, 2005
Posts: 21
Hi All,

I have a question about the "bean things" that can be done at various stages in a session bean life cycle.

Ref page 216 HFEJB- if you see, we can't force transaction rollbacks or find if a transaction has been set for a rollback but we can get transaction references and call methods on them in the ejbCreate() ejbActivate() ejbPassivate and ejbRemove() methods.

The question is why is it that we can perform transaction related operations for BMT beans and not for CMT beans in these methods?

cheers!
nik
Aakash Parashar
Ranch Hand

Joined: Jul 25, 2005
Posts: 121

Hi Nick,


SPEC 7.5.7

A session bean�s newInstance, setSessionContext, ejbCreate, ejbRemove, ejbPassivate, ejbActivate, and afterCompletion methods are called with an unspecified transaction context.


So, you cannot use SessionContext methods to force transaction to complete, this is wit CMT only. In BMT you can definately get TransactionContext from SessionContext in these methods manage to your transaction programatically.

People,

Please correct me if I am wrong.

Thnks.
[ August 30, 2007: Message edited by: Neo Greet ]

Your's Aakash
SCJP 1.4 96%, SCBCD 1.3 94%, http://java-application-programming.blogspot.in
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HFEJB doubt
 
Similar Threads
Transaction propagation with BMT
do we need a meaningful transaction?
Doubt in Session beans
Transaction context in ejbCreate() of a Stateful Session Bean -HFEJB p196
spanning txns across multiple business methods