Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Transactions with Statefull Bean

 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is reason behind "only session bean with BMT can keep transaction open at the end of a method"?
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by gowher amin naik:
what is reason behind "only session bean with BMT can keep transaction open at the end of a method"?



Only STATEFUL session beans with BMT can keep a transaction open at the end of a method!
Remember, stateless and message driven beans(MDBs) are pooled, so two method calls to these types of beans might be served by two different instances! That's why transactions should be closed (commited/rolled back) before your method ends.

If you have a STATEFUL bean, then you have a "conversational state". Every method call will be served by the same instance, therefore with BMT it's possible to keep transactions open between method calls!

If you have container managed transaction(CMT), then all the transactions will last for the time of a method call. They begin when your method starts, and end when your method ends. This is maintained explicitly by the container.

Correct me if i was wrong!
Andor N�meth
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic