Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How does Stateful Session bean store its state

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SFSB store state in their instance variables.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic