Name

SessionBean

Synopsis

This is the base interface for all session enterprise JavaBean implementations. The methods on this interface are used by the EJB container to notify the bean about certain events.

The ejbActivate() and ejbPassivate() methods are invoked by the container when the bean leaves/enters a passive state in the container, respectively. After the ejbPassivate() method completes, the container should be able to serialize the bean object to be stored to disk or some other persistent storage, if the container chooses. During the ejbActivate() method, the bean can restore any data or resources that it released when it was passivated. The container calls ejbRemove() on the bean just before the bean is to be destroyed. The container sets the bean’s context by calling its setSessionContext() method. The session bean keeps the same context throughout its lifetime, so there is no corresponding unset method, as there is for EntityBeans.

                  Thrown By
public interface SessionBean extends EnterpriseBean {
// Public Instance Methods
   public abstract void ejbActivate(
        ) throws EJBException, java.rmi.RemoteException;  
   public abstract void ejbPassivate(
        ) throws EJBException, java.rmi.RemoteException;  
   public abstract void ejbRemove(
        ) throws EJBException, java.rmi.RemoteException;  
   public abstract void setSessionContext(
        SessionContext ctx) throws EJBException, java.rmi.RemoteException;  
}

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.