First page Back Continue Last page Graphics

Unsetting Context


Notes:

unsetEntityContext( ) is called when an entity bean instance is destroyed (not when the entity is removed). It is the very last EJB method called in the bean class, and will only be called if the instance is removed from the pool. Use it to disconnect the bean instance from external resources. There is no corresponding method for session beans because ejbRemove() fills that role.
This table summarizes what methods are called first and last in the life of what beans:
Session Bean Entity Bean
First EJB method: setSessionContext( ) setEntityContext( )
Last EJB method: ejbRemove( ) unsetEntityContext( )
See the examples on the next page...