正在加载图片...
方法对应规则 // Remote接口定义 / enterprise bean类定义 public interface Hello extends EJBObject public class Demo Bean extends Session Bean String busMethod1(long I, String str) public String busMethod1(long I, String str) throws RemoteException, UserExcep1 throws UserExcep2 { //具体实现 8R30R Remote接口中定义的每一个方法都必须在相应的 enterprise bean类中有一个对应方法 函数接口与返回值必须相同 抛出相同的异常必须匹配(用户自定义异常)//Remote接口定义 public interface Hello extends EJBObject { String busMethod1(long l, String str) throws RemoteException, UserExcep1; } //enterprise bean类定义 public class DemoBean extends SessionBean { public String busMethod1(long l, String str) throws UserExcep1 { //具体实现 } //... } 方法对应规则 ◼ Remote接口中定义的每一个方法都必须在相应的enterprise bean类中有一个对应方法 //Remote接口定义 public interface Hello extends EJBObject { String busMethod1(long l, String str) throws RemoteException, UserExcep1; } //enterprise bean类定义 public class DemoBean extends SessionBean { public String busMethod1(long l, String str) throws UserExcep1 { //具体实现 } //... } //Remote接口定义 public interface Hello extends EJBObject { String busMethod1(long l, String str) throws RemoteException, UserExcep1; } //enterprise bean类定义 public class DemoBean extends SessionBean { public String busMethod1(long l, String str) throws UserExcep1 { //具体实现 } //... } ◼ 函数接口与返回值必须相同 ◼ 抛出相同的异常必须匹配(用户自定义异常) //Remote接口定义 public interface Hello extends EJBObject { String busMethod1(long l, String str) throws RemoteException, UserExcep1; } //enterprise bean类定义 public class DemoBean extends SessionBean { public String busMethod1(long l, String str) { //具体实现 } //... } OK //Remote接口定义 public interface Hello extends EJBObject { String busMethod1(long l, String str) throws RemoteException; } //enterprise bean类定义 public class DemoBean extends SessionBean { public String busMethod1(long l, String str) throws UserExcep1 { //具体实现 } //... } ERROR //Remote接口定义 public interface Hello extends EJBObject { String busMethod1(long l, String str) throws RemoteException, UserExcep1; } //enterprise bean类定义 public class DemoBean extends SessionBean { public String busMethod1(long l, String str) throws UserExcep2 { //具体实现 } //... } ERROR
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有