GeeCON Prague 2014*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Best practice using BMT and CMT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Best practice using BMT and CMT" Watch "Best practice using BMT and CMT" New topic
Author

Best practice using BMT and CMT

Himai Minh
Ranch Hand

Joined: Jul 29, 2012
Posts: 763
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
Bartender

Joined: Apr 07, 2010
Posts: 1687
    
  25

The best practice is that you use Container Managed Transactions. Apart from that, if you still want to use BMT: don't mix them.
 
GeeCON Prague 2014
 
subject: Best practice using BMT and CMT