Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply 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: 8876

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: 8876

SFSB store state in their instance variables.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How does Stateful Session bean store its state
 
Similar Threads
pls give help onEJB
Interview Questions Help
How does stateful session bean store its state?
Question regarding State of session bean
New to EJB.. Session Bean