• 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

Why cannot we have a BMT in an Entity Bean

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

So far from my reading of EJB I have gathered that we cannot use a Bean Managed Transaction (BMT) with Entity Beans & Entity Beans strictly have to be CMT

Can someone explain why it has to be that way i.e . Why cannot we have Entity beans with BMT

Rgrds
Rahil
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

From what I understand the way that Entity Beans stay in sync with underlying datastores(i.e. a database), is via couple of the Container Callbacks namely ejbLoad() and ejbStore(). One can be sure that the container always calls ejbLoad after each ejbActivate(), and ejbStore after
each ejbPassivate(), based on the spec, container may call the two mentioned callbacks at any other time or in any order for that matter.
Now lets say that you'd want to have an Entity Bean with BMT demarcation, You'd put your code into ejbLaod() callback method, perhaps around JDBC code. Since there is no guarantee that ejbLoad() will be called when you'd expect it to, your TX may never complete. This is why it is illegal to have bean managed transaction with Entity Beans.

SCJP (2)
SCWCD
SCBCD (In Progress)



 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic