Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Entity beans cannot use BMT

 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is reason behind Entity beans cannot use Bean managed transaction?
Thanks
 
Celinio Fernandes
Ranch Hand
Posts: 549
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a repost :
http://www.coderanch.com/t/163000/java-EJB-SCBCD/certification/BMT-Entity-beans
 
Sanjeev BhimaRao
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure if this is entirely accurate, but these are my thoughts.

Entity Beans exist because there is an entity in the DB that they represent. CMP fields representing the complete entity are declared in the DD, along with abstract getters and setters.

On the other hand, with BMT, the bean manages DB access code by itself upon notification from the container. That means, we could do DB access code or do nothing in the BMT container callback methods. But with CMT, container is in charge of putting the required code for DB access.

This makes me think that a BMT bean is not tied to any real entity. And if its not tied to any real entity, it cannot be an entity bean.

Another point to note is that if a session bean uses an entity bean and if the session bean is in a transaction and wants the entity bean (DB) updates to happen as a part of the same transaction, only CMT would support it. With BMT, the entity bean methods would run in a seperate transaction. So, a scenario like "Insert New Customer through a session bean which uses entity bean" will run into issues.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic