BMP vs. CMP

An important design decision for entity bean developers is the choice between BMP and CMP.

The main advantage of BMP is its flexibility. Because the bean writer explicitly codes the data access logic, he or she has complete control over the entity bean's persistence.

While most entity beans keep a persistent representation in a database, with BMP the bean writer has the flexibility to choose any type of persistent store. For instance, BMP might be used to persist an entity bean to a legacy system.

CMP Design Advantages

A clear advantage of CMP is simplicity. With CMP, the EJB container automatically generates the data access code.

This not only makes the bean simpler, but it also separates the bean code from its persistent representation. ...

Get J2EE™ Applications and BEA™ WebLogic Server™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.