21.1. Bean-Managed versus Container-Managed Persistence

There are two options in handling persistence for an entity bean. With bean-managed persistence (BMP), the bean developer is responsible for writing all of the code needed to handle the bean's persistence. This means, for example, that when an ejbCreate() operation is invoked, the bean developer will write the code to do a JDBC table insert (if a JDBC data source is being used), and likewise the code to do a delete operation if the remove() operation is invoked.

With container-managed persistence (CMP), the developer leaves it to the container to handle the persistence of the bean. CMP is thus easier for the developer to write, although the deployment descriptor becomes more complex with ...

Get J2EE™ and JAX™: Developing Web Applications and Web Services 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.