• 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

Reference To Stateful Session Beans

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Havent worked on EJB's that much(although i am certified).
Was just wondering, in case of Web Sessions ONE client would get the same session object thoughout the Web Application till he/she invalidates the session or it times out etc.

Just wanted to clarify the same thing in case of Sateful Session Beans.
If i am a JSP/Servlet Client, and i am making multiple calls to a Stateful session bean by means of a JNDI lookup in diffrent JSP pages, will i get the same Stateful session bean ...... or do i need to store the reference of the EJBObject in a HttpSession and then use the same in diffrent JSP Pages.

Simply put... when the same client calls the same Stateful Session Bean from diffrent JSP pages in a Web App(By Means of a JNDI Lookup), does he get the same Stateful Session Bean in all cases... or does he need to store the reference of the EJBObject he got in the first place(first JSP Page where look up was performed) in a HttpSession so that its available to all JSP Pages.

Looking forward to a satisfying response....
Cheers..
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Basically, what you look up through JNDI is the home of the stateful session bean. What you usually do with that home is call create() on it to create a new stateful session bean. There is no way to search for an existing stateful session bean through the home interface as you can do with entity beans. So whenever you create a new statefull session bean, you should keep it somewhere (in the session for instance) for later use since every subsequent JNDI calls would get you the home of the session bean which you can only use for creating new stateful session beans (which is not what you want).

Does that answre your question?
 
Whip out those weird instruments of science and probe away! I think it's a tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic