Passivation and Activation in EJB

What is Passivation and Activation in EJB?

Activation is a process of associating an instance with EJB object. Activating a bean is the process of restoring a stateful bean instance’s state relative to its EJB object. When a method on the passivated EJB object is invoked, the container automatically creates a new instance and sets it fields equal to the data stored during passivation. The activation process is supported by the state management call methods ejbActivate () and ejbPassivate () methods which notify the stateful session bean that it is about to be activated or passivated respectively. The ejbActivate () method is called immediately following the successful activation of a bean instance and can be used to reset transient fields to an initial value if necessary.

Passivation is the process of disassociating a bean instance from its EJB object so that the instance can be reused or evicted to conserve memory. Calling of ejbPassivate () for passivation is a warning to the bean that its held conversational state is about to be swapped out. It is important that the container inform the bean using ejbPassivate () so that the bean can relinquish held resources.
How do we implement caching in JSP?
JSP caching lets you cache tag invocation results within the Java engine. Each can be cached using different cache criteria. JSP caching is defined by following:..
Different Authentication options in Servlets
Authentication options available in Servlets: There are four different options for authentication in servlets...
How can we use beans in JSP?
Java Beans are reusable components. They are used to separate Business Logic from Presentation Logic. Internally a bean is just an instance of a class...
Post your comment