This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Why cannot we have a BMT in an Entity Bean  RSS feed

 
Rahil Hurzuk
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • 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
 
Paymon Asadinia
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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)



 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!