BMP Entity Bean Lifecycle

The lifecycle of both BMP and CMP Entity beans is dictated by the EntityBean interface that the bean must implement. This is shown in Figure 6.4.

Figure 6.4. The javax.ejb.EntityBean interface defines certain life-cycle methods that must be implemented by Entity beans.

To start with, the Entity bean must implement the javax.ejb.EntityBean interface, as demonstrated with the JobBean class:

package data;

// imports omitted
import javax.ejb.*;

public class JobBean implements EntityBean
    // implementation omitted

The lifecycle as perceived by the Entity bean and as managed by the container is as shown in Figure 6.5

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.