Announcement Announcement Module
No announcement yet.
Getting the same SFSB over a conversation? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting the same SFSB over a conversation?

    I tried to learn and implement a simple example using EJB3 in a web application. I understand teh diff b/w Stateful and Stateless EJBs. But i am missing is how to get the same SFSB for a sequence of actions.

    My scenario is: I am developing a simple ShoppingCart application. So users browse thru the catelogue and selects an item and click on AddToCart. For the first item i need to get a new CartBean(SFSB) and for the subsequent AddToCart actions i need to get the same CartBean(SFSB) and has to add the items in the collection, say List<Item> instance variable in CartBean.

    But in the EJB3 documentation, i read something like whenever you do a JNDI lookup, you will be given a new EJB instance(whether it is stateful/stateless).

    So my dear EJB gurus, please suggest me how to get the EJB instances, both SLSB and SFSB) in web app environment. It would be great if u give some piece of code examples/ links.

    Thanks in advance.