• 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Confusion regarding stateful session bean

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I am displeased. You are no longer allowed to read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic