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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.