org.springframework.ejb.support
Class AbstractStatelessSessionBean
org.springframework.ejb.support.AbstractEnterpriseBean
|
+--org.springframework.ejb.support.AbstractSessionBean
|
+--org.springframework.ejb.support.AbstractStatelessSessionBean
- public abstract class AbstractStatelessSessionBean
- extends AbstractSessionBean
Convenient superclass for stateless session beans (SLSBs), minimizing
the work involved in implementing an SLSB and preventing common errors.
Note that SLSBs are the most useful kind of EJB.
As the ejbActivate() and ejbPassivate() methods cannot be invoked
on SLSBs, these methods are implemented to throw an exception and should
not be overriden by subclasses. (Unfortunately the EJB specification
forbids enforcing this by making EJB lifecycle methods final.)
There should be no need to override the setSessionContext() or
ejbCreate() lifecycle methods.
Subclasses are left to implement the onEjbCreate() method to do
whatever initialization they wish to do after their BeanFactory has
already been loaded, and is available from the getBeanFactory() method.
This class provides the no-argument ejbCreate() method required
by the EJB specification, but not the SessionBean interface,
eliminating a common cause of EJB deployment failure.
- Author:
- Rod Johnson
- Version: $Id: AbstractStatelessSessionBean.java,v 1.4 2004/02/04 18:01:24 jhoeller Exp $
ejbActivate
public void ejbActivate()
throws javax.ejb.EJBException
- See Also:
- javax.ejb.SessionBean#ejbActivate().
ejbCreate
public void ejbCreate()
throws javax.ejb.CreateException
- This implementation loads the BeanFactory. Any BootstrapException
thrown by loadBeanFactory is rethrown as CreateException.
Don't override it (although it can't be made final): code initialization
in onEjbCreate(), which is called when the BeanFactory is available.
Unfortunately we can't load the BeanFactory in setSessionContext(),
as resource manager access isn't permitted and the BeanFactory may require it.
ejbPassivate
public void ejbPassivate()
throws javax.ejb.EJBException
- See Also:
- javax.ejb.SessionBean#ejbPassivate().