Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ejbactivate() and ejbpassivate()

Status
Not open for further replies.

patnim17

Programmer
Jun 19, 2005
111
US
HI,
I was learning Entity Beans in EJB and wanted to know what ejbactivate() and ejbpassivate() methods are used for? I know that there are called by the container when the bean is being assosiated or disassociated with the remote reference..!

But what code can we put in these methods?

nims
 
They are called when the container wishes to persist the state of an existing bean to permanent store (ejbPassivate), or reload a previously persisted bean back into the pool(ejbActivate).

They are provided to allow the bean author to handle any special needs of the bean in this regard. For example, non-persistable resources used by the bean will need to be freed before the bean can be passivated, and likewise, re-established when the bean is reloaded from store.

They aren't really relevant for Stateless Session Beans, since these don't, by their nature, maintain a state. Stateful Session Beans, however, could realistically get passivated if they are not made us of within a defined length of time.

Tim
---------------------------
"Your morbid fear of losing,
destroys the lives you're using." - Ozzy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top