• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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
 
My name is Inigo Montoya, you killed my father, prepare to read a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic