Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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

Confused about SessionContext

 
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?!
 
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
 
I think she's lovely. It's this tiny ad that called her crazy:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic