Win a copy of Head First Android this week in the Android forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

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
 
reply
    Bookmark Topic Watch Topic
  • New Topic