It is a process that transfers an enterprise bean from
secondary storage to memory.
Stateful session beans maintain sessions while invoking various methods, this phenomena is known as conversational state since it represents the continuing conversation with the stateful session bean?s client. This conversational state requires integrity in order to maintain the life of the bean?s service to the client. While stateful session bean does not allows instance pooling such as stateless session beans and entity beans, but requires activation with stateful session beans to conserve resources. While an EJB server requires conserving of resources then it evicts stateful session beans from memory. This results in reduction to the number of instances maintained by the system. Bean's state is serialized to a secondary storage and maintained relative to its EJB object so that the bean can be passivate and its conversational state can also be preserved. When a client invokes a method on the EJB object, a new stateful session bean creates an instance and populates it with the help of passivated secondary storage.
Activation of a bean is the mechanism of restoring the state of a stateful bean relative to its EJB object. The container automatically creates a new instance and populates its fields equal to the data stored, whenever a method is invoked on the passivated.
The state management call methods ejbActivate () and ejbPassivate () methods supports to the activation process which notify the stateful session bean that it is about to be activated or passivated respectively. The ejbActivate () method is called as that follows successful activation of a bean instance and resets the transient fields to an initial value if necessary.
Liked it! Share this Tutorial