aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Confusion regarding stateful session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Confusion regarding stateful session bean" Watch "Confusion regarding stateful session bean" New topic
Author

Confusion regarding stateful session bean

Kousik Majumder
Ranch Hand

Joined: Sep 30, 2007
Posts: 229
Hi all,

I am new to EJB.
Can somebody explain me with example what 'state' is generally referred to? I have raised two different scenario for my understanding.

Scenario 1:-

Suppose I have added 5 different items in a shopping cart. Each time adding the item in cart EJB is calling and finally when I submit the cart it generates the bill. Does Stateful EJB will maintain this state(from client to server and back to same client)?

my Question:- If so then how it distinguish the call from the same client or different client ?

Scenario 2:-

I have a servlet which calls a stateful session bean from its get() method. When the servlet is called one stateful session bean object from instance pool is associated to this servlet's instance variable of bean.

my Question:-
If so then how the state will be kept for different client(or session) when 10 different client will call the same servlet(if servlet instance is same and its associated bean is also same) ?

Please somebody give me the clarification. I am confused.

Thanks in Advance,
Kousik
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Confusion regarding stateful session bean