Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How does Stateful Session bean store its state

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pradeep bhatt
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SFSB store state in their instance variables.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic