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.
posted 11 years ago
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.