The bean instance is serialized after ejbPassivate() is called. Therefore all state held in the Stateful Session Bean must be serializable or marked as transient.
Joined: Dec 18, 2002
Hi Chris, Stateless session bean also have ejbActivate() & ejbPassivate()s , then how come they doesn't hold their state info.?
Joined: Jul 18, 2001
ejbActivate and ejbPassivate are never called for Stateless Session Beans. They only implement the methods because the EJB Expert Group decided it would better to have a single interface for all Session Beans rather than two separate interfaces for Stateful and Stateless Session Beans.
Coming back to your original question, interesting as it may seem, the EJB sepecification does not say how the conversation state must be stored and restored. It is upto the container implementation- they may use standard Serialization and save the state as an object under java:comp:env JNDI context( or its subcontext). They are free to use other custom implementations too, that are entirely different than the standard Java Serialization protocol. The EJB spec only mandates that no matter what technique is employed to save the conversational state, the result must be consistent and equivalent to using the standard Serialization protocol. Hope that helps.
Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
subject: How does stateful session bean store its state?