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-arg ejbCreate() method required
by the EJB specification, but not the SessionBean interface, eliminating
a common cause of EJB deployment failure.
author: Rod Johnson |