Saturday, January 16, 2010

Template for a EJB

package com.pierre.ejb;


import javax.ejb.SessionBean;
import weblogic.ejb.GenericSessionBean;
import weblogic.ejbgen.RemoteMethod;
import weblogic.ejbgen.Session;
import weblogic.ejbgen.JndiName;
import weblogic.ejbgen.FileGeneration;
import weblogic.ejbgen.Constants;


@Session(ejbName = "MyEJB")
@JndiName(remote = "ejb.MyEJBRemoteHome")
@FileGeneration(remoteClass = Constants.Bool.TRUE, remoteHome = Constants.Bool.TRUE, localClass = Constants.Bool.FALSE, localHome = Constants.Bool.FALSE)

public class MyEJB extends GenericSessionBean implements SessionBean {
    private static final long serialVersionUID = 1L;

    /* (non-Javadoc)
     * @see weblogic.ejb.GenericSessionBean#ejbCreate()
     */
    public void ejbCreate() {
        System.out.println("ejbCreate was invoked for MyEJB");
    }

    @RemoteMethod(transactionAttribute=Constants.TransactionAttribute.SUPPORTS)
    public String sayHello(String name) {
        return name + " , hello";
    }

}   

No comments: