和大家分享一下

http://www.blogjava.net/images/blogjava_net/beansoft/17773/o_ejb2_flow.png</p>

import javax.ejb.EJBHome;
import javax.ejb.CreateException;
import java.rmi.RemoteException;
public interface HelloHome extends EJBHome {
public Hello create() throws CreateException, RemoteException;
}
—————————————————
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
public interface Hello extends EJBObject {
public String sayHello() throws RemoteException;
}
—————————————————
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
import javax.ejb.CreateException;
import java.sql.*;
public class HelloBean implements SessionBean {
SessionContext sessionContext;
public void ejbCreate() throws CreateException {
System.out.println(“ejbCreate()”);
}
public void ejbRemove() {
System.out.println(“ejbRemove()”);
}
public void ejbActivate() {
System.out.println(“ejbActivate()”);
}
public void ejbPassivate() {
System.out.println(“ejbPassivate()”);
}
public void setSessionContext(SessionContext sessionContext) {
this.sessionContext = sessionContext;
}
public String sayHello() {
return “欢迎来到EJB世界!”;
}
}

转载请注明:WebLogic Android 博客 » (原创)EJB 2 工作流程图