File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 Murach's Java Servlets and JSP this week in the Servlets 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

Phanindra varma
Greenhorn

Joined: Jul 29, 2005
Posts: 14
Hi All,
Can anybody please tell me how stateful session bean is maintaining the state? and Why does Stateless Session bean not store its state even though it has ejbActivate and ejbPassivate ?
Thanks in advance. I am waiting for reply.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

The name tells it all.

Stateless beans do not store conversational state. SLSB(Stateless Session beans) are pooled and are shared among clients. So when a request comes for a SLSB the container picks up one from the pool and the picked bean will process the request. Once processing is done the bean goes back to the pool. Later if the same client invokes a method on the same SLSB the container could pick up any available bean from the pool to handle the request. Note that this bean instance could be different from the first one. Since they are pooled ans shared they do not store any conversational state and they do not remember their client.

Stateful session beans are extensions of the client and store client specific state. They are created when a client makes a 'Create' request.

The ejbActivate and ejbPasivate method in SLSB are not used. EJB 3.0 spec (not final as yet) does not require a SLSB to implement the life cycle method.


Groovy
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8903

SFSB store state in their instance variables.
 
jQuery in Action, 2nd edition
 
subject: How does Stateful Session bean store its state
 
Similar Threads
Question regarding State of session bean
How does stateful session bean store its state?
pls give help onEJB
New to EJB.. Session Bean
Interview Questions Help