aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes How does stateful session bean store its state? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "How does stateful session bean store its state?" Watch "How does stateful session bean store its state?" New topic
Author

How does stateful session bean store its state?

Chetan M
Ranch Hand

Joined: Dec 18, 2002
Posts: 43
Hi all,
1> Wanted to know how does a stateful session bean store its state..??

Thanks,


No matter how much you know today, you will have to know more tomorrow.<br /> Hakunamatata !!!
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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.
Chetan M
Ranch Hand

Joined: Dec 18, 2002
Posts: 43
Hi Chris,
Stateless session bean also have ejbActivate() & ejbPassivate()s , then how come they doesn't hold their state info.?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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.
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
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).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How does stateful session bean store its state?