Class AbstractStatelessSessionBean

java.lang.Object
com.onenetwork.platform.tools.ejb.AbstractStatelessSessionBean

public abstract class AbstractStatelessSessionBean
extends java.lang.Object
You generally should not need to use EJBs in platform applications; this is provided primarily for backward compatibility. To control transactions from REST resources, see BaseResource. From server-side code, see TransactionSupport.

Base class for stateless session beans. Modules may define stateless session beans in order to leverage container-managed database transactions.

Platform uses EJB2 Stateless Session Beans for transaction management. You can add new stateless session beans to your Module by using the following conventions:

  • Name the class using the convention *Bean, for example RegistrationBean
  • Place the bean in the server package of your module (or a subpackage), for example com.mycompany.mymodule.server.RegistrationBean
  • Add XDoclet tags to define bean attributes such as transaction policy/etc. Each new Module is created with a SampleAccessorBean which you can use as a reference.
Deployment descriptors and Local/Home/etc interfaces are all generated by XDoclet. Source is generated into the build/gen-src directory of your module. If you navigate to that directory, you will see five classes generated for a class such as SampleAccessorBean:
  • SampleAccessor - Remote interface
  • SampleAccessorHome - Remote Home interface
  • SampleAccessorLocal - Local interface
  • SampleAccessorLocalHome - Local Home interface
  • SampleAccessorUtil - Utility class for acquiring Remote and Local Home
In Platform it is not necessary to use Remote interfaces. EJBs are always hosted in the same VM as their clients (including the web layer), therefore you should write all your code to the Local and LocalHome interfaces.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected javax.ejb.SessionContext ctx
    EJB session context, available to subclasses
  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractStatelessSessionBean()  
  • Method Summary

    Modifier and Type Method Description
    void ejbActivate()
    Default implementation does nothing.
    void ejbCreate()
    Default implementation does nothing.
    void ejbPassivate()
    Default implementation does nothing.
    void ejbRemove()
    Default implementation does nothing.
    void setSessionContext​(javax.ejb.SessionContext ctx)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ctx

      protected javax.ejb.SessionContext ctx
      EJB session context, available to subclasses
  • Constructor Details

  • Method Details

    • ejbActivate

      public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
      Default implementation does nothing.
      Throws:
      javax.ejb.EJBException
      java.rmi.RemoteException
    • ejbPassivate

      public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
      Default implementation does nothing.
      Throws:
      javax.ejb.EJBException
      java.rmi.RemoteException
    • ejbRemove

      public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
      Default implementation does nothing.
      Throws:
      javax.ejb.EJBException
      java.rmi.RemoteException
    • setSessionContext

      public void setSessionContext​(javax.ejb.SessionContext ctx) throws javax.ejb.EJBException, java.rmi.RemoteException
      Throws:
      javax.ejb.EJBException
      java.rmi.RemoteException
    • ejbCreate

      public void ejbCreate() throws javax.ejb.CreateException
      Default implementation does nothing.
      Throws:
      javax.ejb.EJBException
      java.rmi.RemoteException
      javax.ejb.CreateException