Creating a stateful session bean
In order to illustrate the creation of a stateful EJB, we will use a bean to maintain a list of names. A name will be entered in the
index.jsp page and passed to a servlet. The servlet will add the name to the stateful bean. Unique to the stateful EJB is the process of passivation. When a stateful bean is experiencing a period of inactivity, the EJB container may decide to remove it from memory temporarily. This process is called passivation. Most of the state of the EJB is saved automatically except for transient fields. When the EJB is restored, the stateless EJB has its original content except for the transient fields.
Creating a stateful session bean requires:
- Annotating a class with the @Stateful ...