7.6 LIFECYCLE OF AN EJ BEAN

The EJB container manages the lifecyle of a bean. The EJB container itself is in most cases a part of the Application Container, though it could be separate. For simplicity let us assume they are available in the same application server. Glassfish Java EE compliant Application Server comes with a Web Server, a Servlet container, an EJB container and a JPA provider.

The lifecycle depends on the type of the Bean. Let us consider the case for Stateless Session Bean, Stateful Session Bean and a Message driven Bean. Their states can simply be represented in Figure 7.2.

 

(A) Stateless session bean (B) Stateful session bean

 

Fig. 7.2 (A) Stateless session bean (B) Stateful ...

Get Web Technology: Theory and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.