• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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?
 
Look! I laid an egg! Why does it smell like that? Tiny ad, does this smell weird to you?
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic