facebook

Using am abstract superclass for SessionBean with xDoclet

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MyEclipse IDE
  2.  > 
  3. Java EE Development (EJB, JSP, Struts, XDoclet, etc.)
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #232860 Reply

    mahy
    Member

    We are using MyEclipse version 3.8.4 and want to use an abstract SessionBean superclass that implements ejbActivate(), ejbCreate() … nothing special.

    But if we do so xDoclet doesn’t generate any create() method in the home interfaces and we cannot deploy the beans. Can anybody help us pls?!

    Thanks

    #232886

    Riyad Kalla
    Member

    I’ll ask our EJB guy to take a look.

    #232953

    Greg
    Member

    You may have to put xdoclet tags in your superclass files as well. If you continue to have trouble, post a couple of sample source files complete with xdoclet tags and we can try to help out.

    #232956

    mahy
    Member

    Ok, this is our abstract super class that implements the SessionBean interace and also the ejbCreate() method:

    
    public abstract class AbstractSessionBean implements SessionBean {
    
        private SessionContext context;
    
        public AbstractSessionBean() {
            super();
        }
    
        public void ejbActivate() throws EJBException, RemoteException {
        }
    
        public void ejbPassivate() throws EJBException, RemoteException {
        }
    
        public void ejbRemove() throws EJBException, RemoteException {
        }
    
        public void setSessionContext(SessionContext newContext)
            throws EJBException {
            context = newContext;
        }
    
        /**
         * @ejb.create-method
         */
        public void ejbCreate() throws CreateException {
        }
    }
    

    An implementing SessionBean looks like:

    
    /**
     * 
     * @ejb.bean name="MySession"
     *           display-name="Name for MySession"
     *           description="Description for MySession"
     *           jndi-name="ejb/MySession"
     *           type="Stateless"
     *           view-type="remote"
     */
    public class MySessionBean extends AbstractSessionBean {
    
        public MySessionBean() {
            super();
        }
    
        /**
         * An example business method
         *
         * @ejb.interface-method view-type = "remote"
         * 
         * @throws EJBException Thrown if method fails due to system-level error.
         */
        public void replaceWithRealBusinessMethod() throws EJBException {
            // rename and start putting your business logic here
        }
    
    }
    

    xDoclet is generating the remote and home interfaces for both AbstractSessionBean and MySessionBean. AbstractSessionHome gets a create method:

    
    public interface AbstractSessionHome
       extends javax.ejb.EJBHome
    {
       public static final String COMP_NAME="java:comp/env/ejb/AbstractSession";
       public static final String JNDI_NAME="ejb/AbstractSession";
    
       public de.awd.vertriebsportal.service.facade.test.interfaces.AbstractSession create()
          throws javax.ejb.CreateException,java.rmi.RemoteException;
    
    }
    

    But the interface MySessionHome not:

    
    public interface MySessionHome
       extends de.awd.vertriebsportal.service.facade.test.interfaces.AbstractSessionHome
    {
       public static final String COMP_NAME="java:comp/env/ejb/MySession";
       public static final String JNDI_NAME="ejb/MySession";
    
    }
    

    We could reimplement the ejbCreate-Method in MySessionBean of course, but that would be no great solution.

    We also tried to generate the superclass with the xDoclet wizard, so that the superclass obtains its own xdoclet tags, but it doesn`t work either.

    Thanks
    Marc

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Using am abstract superclass for SessionBean with xDoclet

You must be logged in to post in the forum log in