First page Back Continue Last page Graphics

...Session Beans


Notes:

In the bean class instance, the container calls the ejbRemove( ) method from the SessionBean interface just before releasing the instance. Thus it is the last EJB method called in the life of the bean instance. ejbRemove( ) would typically release the same resources acquired in the ejbCreate( ) method, and may look very much like. the ejbPassivate( ) method.
Note that while create( ) / ejbCreate( ) can be overloaded, there is only one remove( ) / ejbRemove( ) pair. Like a C++ destructor or Java's finalize( ) method, these are not overloaded.
The bean instance can abort the removal by throwing an EJBException containing a nested exception. This comes back to the client as a RemoteException thrown on the remove( ) call.
For example, on the next page is the LegacyAppSessionBean class again, showing its ejbRemove( ) method. Note the similarity to ejbPassivate().