• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Sujay Kamble
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.
 
Janne Karhu
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.
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FYI, similar thread
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic