This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring Boot in Practice and have Somnath Musib on-line!
See this thread for details.
Win a copy of Spring Boot in Practice this week in the Spring 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:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic