wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Reg SessionSynchronization Interface 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 "Reg SessionSynchronization Interface" Watch "Reg SessionSynchronization Interface" New topic
Author

Reg SessionSynchronization Interface

Ashwin
Greenhorn

Joined: Dec 19, 2004
Posts: 3
It is stated in the HF EJB book that "Stateless session beans cannot use SessionSynhronization Interface becuase stateless session beans cannot maintain a transaction once method has ended".

How is this true even in the case of CMT beans. Cant we just maintain the transaction across the "stateless CMT beans" methods using appropriate trans-attributes.

Thanks,
Ashwin.
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
OK, for completeness' sake, a stateless session bean with bean-managed transaction demarcation MUST commit any transaction before the end of its business methods as stated in the EJB spec 2.0 section 17.3.3.

As for stateless CMT beans, there is no way to let a transaction span across multiple calls using transaction attributes since you, the bean provider, are not in charge of managing transactions because you charged the container to do it. And since transaction demarcations are specified on a per method basis in the deployment descriptor, CMT stateless session beans cannot maintain transactions across multiple calls. You should use stateful session beans for that purpose. Note that the role of transaction attributes is NOT to let you span a transaction across several calls but just to hint the container at how method-level transactions should be managed.


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
jQuery in Action, 2nd edition
 
subject: Reg SessionSynchronization Interface
 
Similar Threads
SessionSynchronization !!
transaction registerSynchronization()
Query - SessionSynchronization interface
why stateless session bean cannot implement SessionSynchronisation?
Stateless beans and SessionSynchronization