• 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

HFE Page 228: sessionContext.getEJBObject() in ejbCreate() of stateless session bean.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Headfirst EJB on Page 228 , its mentioned that u can use the sessionContext.getEJBObject() in the ejbCreate method of a stateless session bean.
But a stateless session bean is linked to its EJBObject only when a client invokes a business method on the remote interface (HeadFirst Page 226 point #2).
Then how is it possible to get a reference to the EJBObject in the ejbCreate of a stateless session bean.
Sujay.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is very interesting indeed - I checked the book and the spec, and there seems to be no simple explanation for this! Maybe the container creates an EJB-object for each stateless session bean before calling ejbCreate() anyway (or uses the same EJB object for each stateless bean from the same home?), or there's a mistake in the spec.
BTW: this is not the only problem in the spec, there is more like this in "operations allowed" sections (related to transactional context and allowed methods).

Originally posted by Sujay Kamble:
In Headfirst EJB on Page 228 , its mentioned that u can use the sessionContext.getEJBObject() in the ejbCreate method of a stateless session bean.
But a stateless session bean is linked to its EJBObject only when a client invokes a business method on the remote interface (HeadFirst Page 226 point #2).
Then how is it possible to get a reference to the EJBObject in the ejbCreate of a stateless session bean.
Sujay.

 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
FYI, similar thread
 
reply
    Bookmark Topic Watch Topic
  • New Topic