• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Best practice using BMT and CMT

 
Himai Minh
Ranch Hand
Posts: 1328
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In EJB in Action (2nd edition) p.195,

The best approach for both managing transactions and security is to use declarative transactions (CMT) and declarative security.... CMT and BMT can't be mixed in the same bean and using BMT for one bean and CMT for another bean will cause complications quickly if one bean uses the other.


For best practice, does it mean we should define all beans with either @TransactionManagement (TransactionManagementType.CONTAINER) or @TransactionManagement(TransactionManagementType.BEAN) in an .ear, and not to define some beans with TransactionManagementType.CONTAINER and some others with TransactionManagementType.BEAN ?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2445
96
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The best practice is that you use Container Managed Transactions. Apart from that, if you still want to use BMT: don't mix them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic