• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Confused about SessionContext

 
Christer Hedstr´┐Żm
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 190 in HFE it says (about the SessionContext), among other things, that you can "get a reference to your EJB object" but on page 196 it only says you can "get a reference to your home". Is the key here where you are in the creationprocess?! I mean that on page 190 the bean has been created but on page 196 the bean itself has not been created when the setSessionContext() method is run?!
 
C Chavan
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at the lifecycle, when setSessionContext() is called by container on newly created bean, although an EJBObject is created by container, it is not associated with that particular bean instance.
when container finishes call to ejbCreate(), at that time, SessionContext and EJBObject both are linked to that particular bean.
Therefore,
inside ejbCreate(), calling sessionContext.getEJBObject() is OKAY
inside setSessionContext(), calling sessionContext.getEJBObject() is NOT OKAY
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic