Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • Quote
  • Report post to moderator
FYI, similar thread
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic