Win a copy of Getting started with Java on the Raspberry Pi this week in the Raspberry Pi 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Liutauras Vilda
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Piet Souris

Bean things for ejbActivate

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
In the HF, it is said that ejbActivate can get access to primary key as well as EJBObject.
I have a concern here. ejbActivate will be called on a bean in pool. So no information about primary key or EJBObject will be related with that bean in the pool. Then how can we get access to primary key and EJBOject from ejbActivate.


Thanks and Regards
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
before running ejbActivate(), the container will give the EJBObject identity to the entity context.
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gowda
Remember ejbActivate() is called after the container avtivates the bean instance so container has already assigned the EJBObject & primarykey to the bean instance before calling this method.
See ejb specification 2.0 page 171
--------------------------------------------------------------------------
public void ejbActivate();
The container invokes this method on the instance when the container picks the instance from
the pool and assigns it to a specific entity object identity. The ejbActivate() method gives
the entity bean instance the chance to acquire additional resources that it needs while it is in the
ready state.
This method executes with an unspecified transaction context. The entity bean must not
attempt to access its persistent state or relationships using the accessor methods during this
method.
The instance can obtain the identity of the entity object via the getPrimaryKey(), getEJBLocalObject(),
or getEJBObject() method on the entity context. The instance
can rely on the fact that the primary key and entity object identity will remain associated with
the instance until the completion of ejbPassivate() or ejbRemove().
 
KRK Gowda
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks awishek,
That cleared my confusion


Thanks and Regards
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
    Bookmark Topic Watch Topic
  • New Topic