t********k 发帖数: 808 | 1 方法一
InitialContext ic = new InitialContext();
Object lookup = ic.lookup("EJBLocalJndiName");
EJBHome home (EJBHome)PortableRemoteObject.narrow(lookup,EJBHome.class);
EJBLocal local = home.create();
方法二
InitialContext ic= new InitialContext();
EJBHome home = (EJBHome)ic.lookup("EJBLocalJndiName");
EJBLocal local = home.create();
我用2调用Session Bean里的方面,
方法声明在Local Interface里,SessionBean里有这些方法的实现,而在Home Interface只
有create方法,返回Local Interface
用3调用CMP
方法声明在Home Interface里(如finder之类的方法),在Local Interfac | s*******k 发帖数: 20 | 2 方法1 is for EJB with remote interface.
方法2 is for EJB with local interface.
方法3 Home interface, not the bean interface, should provide finder methods.
【在 t********k 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 方法一 : InitialContext ic = new InitialContext(); : Object lookup = ic.lookup("EJBLocalJndiName"); : EJBHome home (EJBHome)PortableRemoteObject.narrow(lookup,EJBHome.class); : EJBLocal local = home.create(); : 方法二 : InitialContext ic= new InitialContext(); : EJBHome home = (EJBHome)ic.lookup("EJBLocalJndiName"); : EJBLocal local = home.create(); : 我用2调用Session Bean里的方面,
|
|