The moose likes EJB and other Java EE Technologies and the fly likes EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB" Watch "EJB" New topic


dhanu sudha

Joined: Apr 16, 2002
Posts: 11
How container is maintaining state for stateful session bean behind the scene?
I need a clear idea.
Can anybody clarify it?
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
Hi dhanu,
We have a naming policy here at JavaRanch where all publicly displayed names take the form, "Firstname surname". Could you please change yours to bring it into line?
Thanks in advance and we hope that you enjoy your stay at the ranch!
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
It's pretty clear from reading the spec (and true in pretty much every implementation) that the default is that the state of a stateful session bean is simply held in an in-memory object; a unique instance of the bean implementation class. That is why we have passivation for stateful session beans -- if the number of bean instances exceeds a preset limit in the container (indicating that too much of the heap is being taken up) then some of the excess beans of that type will be passivated (saved to a file on the disk in serialized form).

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
Originally posted by dhanu:
How container is maintaining state for stateful session bean behind the scene?
I need a clear idea.
Can anybody clarify it?

In Stateful Session Bean after every method calls the information will be stored in the secondary storage medium. And when stateful session bean calls a method it will check the client information details, and retrieve the corresponding data from the secondary storage medium.
sandy gupta
Ranch Hand

Joined: Jan 30, 2001
Posts: 228
Hi Sudha,
I dunno if you got what you were looking for or not but here is what i will add:
Stateful session beans are just like the instances of a Class which is non static while as Stateless session beans are just like abstract classes or static classes if u like (once a C++ lover, always a C++ lover). So that way the state can be maintained across invocations to stateful session beans but not across stateless session beans. Rest everything is said up there.
Thnx :-)

I agree. Here's the link:
subject: EJB
It's not a secret anymore!