• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Activate

 
A Smith
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What exactly happens during ejbActivate()?
Could anyone tell me step by step the various things a Container does during the time of activation?
What will the activated bean do thereafter?
 
Brian Tinnel
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a nutshell, the Container deserializes a previously serialized SFSB and then calls ejbActivate to let the bean know that it needs to restore any state that was not included in the serialization, for example, because a field was marked as transient or was nulled out during ejbPassivate.
 
Franck Tranchant
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Mastering EJB (2nd Edition) (c)Wiley

Required Methods for Session Bean Classes :

(...)

METHOD : ejbActivate()

DESCRIPTION : Called immediately before your bean is activated (swapped in from disk because a client needs your bean).

TYPICAL IMPLEMENTATION (STATELESS SESSION BEANS) : Acquire any resources your bean needs, such as those released during ejbPassivate().

TYPICAL IMPLEMENTATION (STATEFUL SESSION BEANS) : Unused because there is no conversational state; leave empty.



Descriptions and Implementation Guidelines for Bean-Managed Persistent Entities :

(...)

METHOD : ejbActivate()

EXPLANATION : When a client calls a business method on an EJB object, but no entity bean instance is bound to the EJB object, the container needs to take a bean from the pool and transition it into a ready state. This is called activation. Upon activation, the ejbActivate() method is called by the EJB container.

TYPICAL IMPLEMENTATION : Acquire any resources, such as socket connections, that your bean needs to service a particular client when it is moved into the ready state. Note : You should not read the entity bean data from the database in this method. That is handled by a separate method, ejbLoad(), which is called right after ejbActivate().
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!