File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Reg SessionSynchronization Interface" Watch "Reg SessionSynchronization Interface" New topic

Reg SessionSynchronization Interface


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.

Valentin Crettaz
Gold Digger

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.

[Blog] [Blogroll] [My Reviews] My Linked In
I agree. Here's the link:
subject: Reg SessionSynchronization Interface
It's not a secret anymore!