What is Container Managed Persistence?
CMP provides a standard mechanism for implementing persistent business components in the J2EE component model. It defines the life cycle of entity bean instances and management model for entity bean’s persistence state and relationships. It ensures that an entity bean is portable across all J2EE-compliant EJB containers. Persistence is provided by the container transparently through generated implementation classes for entity beans. Entity beans are logically independent of the underlying datasource where the persistence state is stored. Entity beans rely on CMP to generate methods that perform persistent data access for entity bean instances. These generated methods transfer data between entity bean instances and the underlying resource manager. Persistence is handled by the container at runtime. The advantage of CMP is that the entity bean can be logically independent of the datasource in which the entity is stored.