• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejbCreate for stateless sessions beans

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am studying for the SCBCD exam and I would appreciate if someone is able to shed some light on a puzzling aspect of the specification....

According to HFEJB and the spec, within the ejbCreate method of a stateless session bean, you should be able to get a reference to your EJBObject through the SessionContext. How is this possible?

It seems to contradict the lifecycle of a stateless session, which states that the constructor, setSessionContext and ejbCreate are called by the container at a completely independent time from a call by the client, and are taken from the pool only to service a business method call, then put back immediatly after. This would seem to indicate that the bean is only connetced to an EJBOBject at the time the client calls a business method, and could be linked to a different EJBObject each time it is pulled from the pool.

So, as the ejbCreate method is only called once, at bean creation, (unlike entity beans), I can't understand how the SessionContext can have a reference to an EJBObject???

Me is very confused.....can anyone help?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It should be something like connection pool. J2EE server implementation is done in order to store live references of EJB objects in somewhere and passing it when it is required. This is not an impossible task. And also we don�t need to worry about this as far as we are not going to implement a J2EE server.
 
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi William

yes it's a confusing one..but read this Kathy's explanation

It is giving a good understanding.
 
William Parker
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys - Kathy's explanation helps to make sense of this!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic