1 Reply Latest reply on Mar 31, 2005 3:42 AM by winterer

    Can a local interface extend a remote interface?

    keyurva

      Will this work? If it works, is it a good pattern to follow?:

      @Remote
      public interface MyRemote {
       RemoteableObject getRemoteableObject();
      }
      
      @Local
      public interface MyLocal extends MyRemote {
       LocalObject getLocalObject();
      }
      
      @Stateless
      public class MyEJB implements MyLocal, MyRemote {
      ...
      }
      

      MyEJB implementing MyRemote is redundant, but doing it this way will ensure that the container automatically creates local and remote JNDI bindings

        • 1. Re: Can a local interface extend a remote interface?
          winterer

          I think it is better you do it that way:

          public interface MyInterface {
           /* insert your methods here */
          }
          
          @Local
          public interface MyLocal extends MyInterface {
           /* empty - inherits methods from MyInterface */
          }
          
          @Remote
          public interface MyRemote extends MyInterface {
           /* empty - inherits methods from MyInterface */
          }
          
          @Stateless
          public class MyEJB implements MyLocal, MyRemote {
          ...
          }