• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confusion regarding stateful session bean

 
Kousik Majumder
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic