Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HFEJB page 354

 
Suman Sarker
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Page 354 of HFEJB it's shown that while in ejbActivate(), EntityContext can be used to
- get a reference to EJBObject
- get the primary key
We know that ejbActivate() is called to get a bean out of the pool. Now my question is if the bean is in the pool, how come we can get its EJBObject and the primary key.
Can anyone explain this?
Thanks
Suman
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EntityContext is always associated with the bean instance, so the instance can always get the PK. Note that information such as the PK, EJBObject and EJBLocalObject will change as the container assigns the instance to different EJB objects during the instance's life cycle.
 
Suman Sarker
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Roger for your reply.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!