Class AbstractSessionBean

All Implemented Interfaces:
javax.ejb.EnterpriseBean,, javax.ejb.SessionBean
Direct Known Subclasses:

public abstract class AbstractSessionBean
extends AbstractEnterpriseBean
implements javax.ejb.SessionBean

Convenient superclass for session beans.
SFSBs can extend this class directly, leaving them to implement the ejbActivate() and ejbPassivate() lifecycle methods to comply with the requirements of the EJB specification.
SLSBs will extend the AbstractStatelessSessionBean subclass of this class.
This class saves the session context provided by the EJB container in an instance variable and provides a NOP implementation of the ejbRemove() lifecycle method.
NB: We cannot use final for our implementation of EJB lifecycle methods, as this violates the EJB specification.

Rod Johnson
See Also:
Serialized Form

Fields inherited from class
Constructor Summary
Method Summary
 void ejbRemove()
          This method is required by the EJB Specification.
protected  javax.ejb.SessionContext getSessionContext()
          Convenience method for subclasses.
 void setSessionContext(javax.ejb.SessionContext sessionContext)
          Sets the session context.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.ejb.SessionBean
ejbActivate, ejbPassivate

Constructor Detail


public AbstractSessionBean()
Method Detail


public void setSessionContext(javax.ejb.SessionContext sessionContext)
Sets the session context.
If overriding this method, be sure to invoke this form of it first.
Specified by:
setSessionContext in interface javax.ejb.SessionBean
sessionContext - SessionContext Context for session


public void ejbRemove()
This method is required by the EJB Specification.
Specified by:
ejbRemove in interface javax.ejb.SessionBean


protected final javax.ejb.SessionContext getSessionContext()
Convenience method for subclasses. Return the EJB context saved on initialization.
the SessionContext saved on initialization by this class's implementation of the setSessionContext() method.

Rod Johnson and Spring contributors 2001-2003.