javax.ejb

Interface SessionBean

  • All Superinterfaces:
    EnterpriseBean, Serializable

    public interface SessionBean
    extends EnterpriseBean
    The SessionBean interface defines methods that the EJB container uses to notify a session bean instance of the instance's life cycle events.

    As of EJB 3.0 it is no longer required that a session bean class implement this interface.

    Since:
    EJB 1.0
    • Method Detail

      • setSessionContext

        void setSessionContext(SessionContext ctx)
                        throws EJBException,
                               RemoteException
        Set the associated session context. The container calls this method after the instance creation.

        The session bean instance should store the reference to the context object in an instance variable.

        This method is called with no transaction context.

        Parameters:
        ctx - A SessionContext interface for the instance.
        Throws:
        EJBException - Thrown by the method to indicate a failure caused by a system-level error.
        RemoteException - This exception is defined in the method signature to provide backward compatibility for applications written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.
      • ejbRemove

        void ejbRemove()
                throws EJBException,
                       RemoteException
        A container invokes this method before it ends the life of the session object. This happens as a result of a client's invoking a remove operation, or when a container decides to terminate the session object after a timeout.

        This method is called with no transaction context.

        Throws:
        EJBException - Thrown by the method to indicate a failure caused by a system-level error.
        RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.
      • ejbActivate

        void ejbActivate()
                  throws EJBException,
                         RemoteException
        The activate method is called when a stateful session bean instance is activated from its "passive" state. The instance should acquire any resource that it has released earlier in the ejbPassivate method.

        This method is called with no transaction context.

        Throws:
        EJBException - Thrown by the method to indicate a failure caused by a system-level error.
        RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.
      • ejbPassivate

        void ejbPassivate()
                   throws EJBException,
                          RemoteException
        The passivate method is called before a stateful session bean instance enters the "passive" state. The instance should release any resources that it can re-acquire later in the ejbActivate method.

        After the passivate method completes, the instance must be in a state that allows the container to use the Java Serialization protocol to externalize and store away the instance's state.

        This method is called with no transaction context.

        Throws:
        EJBException - Thrown by the method to indicate a failure caused by a system-level error.
        RemoteException - This exception is defined in the method signature to provide backward compatibility for enterprise beans written for the EJB 1.0 specification. Enterprise beans written for the EJB 1.1 specification should throw the javax.ejb.EJBException instead of this exception. Enterprise beans written for the EJB2.0 and higher specifications must throw the javax.ejb.EJBException instead of this exception.

Traduction non disponible

Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.

Version en cache

21/08/2025 19:09:33 Cette version de la page est en cache (à la date du 21/08/2025 19:09:33) afin d'accélérer le traitement.
Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la version plus récente de la page.

Document créé le 14/04/2008, dernière modification le 18/08/2025
Source du document imprimé : https://www.gaudry.be/java-api-javaee-rf-javax/ejb/sessionbean.html

L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.

Références

  1. Consulter le document html Langue du document :fr Manuel PHP : https://docs.oracle.com, SessionBean

Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.