• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reg SessionSynchronization Interface

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic