Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Between Bean Managed and Container Managed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What criterias should be considered for selection between a Bean Managed or a container Managed ?
 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
CMP requires less coding, make it easier to port easity among relational databases, no need to worry about DAO (DAO is already built in). Currently bean-managed transaction is supported only for CMP's. You cannot control the CMP's.
BMP are good when you need to used other legac systems to access data and where CMP is not good. Also, with BMP's you have control on when data is flushed to the data-store. i.e. you have full control of the bean.
Faisal
 
Author
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The general answer would be: use CMP whenever possible. Only when CMP does not support what you would like to do (for example accessing complicated ER schemas or other than relational DBs) then you should use BMP.
In practice however some developers use BMP to achieve better performance. Also in earlier EJB versions (like 1.0) CMP did not work as expected. As technology matures this has changed.
Using CMP namely reduces the amount of code we have to write, increases the portability and reuse and makes it possible to use the container provided optimizations.
Cheers,
Matjaz

------------------
Matjaz Juric
Author of Professional EJB
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic