• Post Reply Bookmark Topic Watch Topic
  • New Topic

Persistence in the Enterprise - CMT or BMT?  RSS feed

 
Regis Santos
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Barcia,

Can you tell me what is the best strategy for transactions in an enterprise application: CMT or BMT?
 
Roland Barcia
author
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a Java EE App Server, I favor using Container Managed Transactions. WIth EJB 3, it is as simple as @Stateless on your POJO. Why not use it?

You can layer your code in such a way though to allow unit testability out of the container.
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, that's a limited view of persistence in the enterprise -- EJB persistence and transaction management is only one choice among many, including non-EJB options like iBatis and Hibernate Core that we cover in our book.

However, in general, I've found that if you're doing EJB persistence, that CMT is the way to go -- BMT will lead to more work for less benefit.
[ July 22, 2008: Message edited by: Kyle Brown ]
 
Geoff Hambrick
author
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are very few cases where one might need BMT, the main reason you might even consider BMT is when your container does not support the underlying data store that you want to access. But since most folks use a Session Facade rather than the Entity Home methods to "wrapper" the data layer, the DAO pattern or JPA are the better choices.

Ok then, Geoff
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!