- 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
The javax.ejb Package for Entity Beans
Yesterday, you saw the interfaces and classes in the javax.ejb package that related to Session beans. Figure 6.2 shows the interfaces and classes relevant to Entity beans.
Figure 6.2 The javax.ejb interfaces and classes pertaining to Entity beans.
As you can see, many of the supporting classes are common, which is good news because that means there's less to learn. The principle differences are as follows:
The Entity bean implements javax.ejb.EntityBean rather than javax.ejb.SessionBean, so there is a different lifecycle.
The Entity bean is initialized with an EntityContext rather than a SessionContext. An EntityContext exposes a primary key to the Entity bean, a concept not applicable to Session beans.
Other details of the javax.ejb interfaces are the same as for Session beans. Briefly, the home and remote interfaces for the Entity bean are defined by extending EJBHome and EJBObject, respectively, and the local-home and local interfaces by extending EJBLocalHome and EJBLocalObject. You will be learning more about local interfaces later today, because they are highly relevant to implementing Entity beans. The EJBMetaData class provides access to the constituent parts of the Entity bean component, and the Handle and HomeHandle interfaces provide the ability to serialize a reference to a remote bean or home and then to re-instantiate this instance by deserializing the handle. None of these interfaces is discussed further.