1 Reply Latest reply on Mar 15, 2006 9:50 AM by Bill Burke

    EJB 3.0 Local Interface?

    Milen Angelov Newbie

      Hi there,
      I have a theoretical question regarding Local Interface for Stateless Session bean and calling it from another Stateless Bean.
      I looked for more information in the spec and several other place for more info but couldn't find.

      Lets imagine I have the following stateless:

      @Stateless(name = "SessionFacade")

      @Remote(SessionFacade.class)

      public class SessionFacadeBean implements SessionFacade{
      @EJB
      AnotherSessionLocal anotherSession;
      ....
      public Something getAnything(){
      return anotherSession.getThatThing(); // what will happen here?
      }
      }

      and here is AnotherSessionBean:

      @Stateless(name="AnotherSession")
      @Remote(AnotherSession.class)
      @Local(AnotherSessionLocal.class)
      public class AnotherSessionBean implements AnotherSession, AnotherSessionLocal {
      }

      In usual JBoss server calling a method of AnotherSession from SessionFacadeBean will be fine, but what will happen if the client decides to go for a clustered servers solution? What will happen with that call? Is there any guarantees that AnotherSession will be created on the same machine as SessionFacade? Should I go for RemoteInterface call in case of cluster?

      I've read carefully "3.2.3 Choosing Between a Local or Remote Client View" from the specification (JSR 220: Enterprise JavaBeansTM,Version 3.0 - EJB Core Contracts and Requirements) and because of some reasons mentioned there I need to call AnotherSession by Local Interface.

      If anyone can give an advice about the situation with the clustered env.?

      Thanks in advance!