- The javax.ejb Package for Entity Beans
- Entity Bean Types
- Remote Versus Local Interfaces
- BMP Entity Bean Lifecycle
- Specifying a BMP Entity Bean
- Implementing a BMP Entity Bean
- Configuring and Deploying a BMP Entity Bean
- Client's View
- Session Beans Revisited
- Patterns and Idioms
Entity Bean Types
Entity beans represent shared persistent data stored in an RDBMS or other persistent data store. If the data store is relational, the responsibility for actually performing the JDBC can be placed either with the bean itself or with the EJB container.
The term for the former is bean-managed persistence (BMP), and for the latter it is container-managed persistence (CMP).
The EJB specification is very much oriented around relational data stores. Certainly, container-managed persistence can only be performed through JDBC javax.sql.DataSource objects, and JDBC is based around ANSI SQL 92.
If using bean-managed persistence, any API can be used to save the bean's state to a persistent data store, but even then, the methods that the bean is required to provide, such as findByPrimaryKey(), still have a relational nature to them.
Container-managed persistence was part of the EJB 1.1 specification (the predecessor to the current EJB 2.0), but attracted much criticism in that release. However, it has been radically overhauled in EJB 2.0, and now works in a fundamentally different way. This is so much so that the deployment descriptor even has the cmp-version element to indicate whether the Entity bean has been written under the 1.1 or 2.0 contract. Tomorrow, you will learn more about CMP 2.0. For the rest of today, however, you will be focusing on BMP. That way, you'll have a pleasant surprise when you realize how much of the coding can be automated using CMP.