O'Reilly logo

Sams Teach Yourself EJB in 21 Days by Krishna Kothapalli, Ragae Ghaly

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Types of Entity Persistence

Entity beans have two types of persistence: bean-managed persistence (BMP) and container-managed persistence (CMP). These two types are based on who is responsible for entity bean persistence bean provider or EJB provider.

Bean-Managed Persistence

With bean-managed persistence, the entity bean code that you write contains the calls that access the database. The data access can be coded into the entity bean class or encapsulated in a data access object that is part of the entity bean. Figure 8.3 depicts how bean-managed persistence works with database access.

Figure 8.3. Bean-managed persistence contains the calls that access the database.

For example, as shown in the following snippet, the StudentEJB method ejbCreate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required