EJB programming & troubleshooting: Remote interfaces, stubs, proxies, etc...

  1. Remote interfaces, stubs, proxies, etc... (1 messages)

    Got the following doubt. Please take a look at some code...

    public interface StoreAccess extends javax.ejb.EJBObject
      // ... StoreAccess is the remote interface of my bean

    and in StoreAccessClient.java i have the following line of code. Question here... don't get, an interface getting a ref to other interface?

    au.com.tusc.session.StoreAccess myBean = getHome().create();

    Method getHome() returns StoreAccessHome (wich is the home interface of StoreAccess bean), and create returns StoreAccess, wich is an interface!
    So, what's actually going one here? An interface receives a reference to other interface or receives a reference to the object of that interface implemented by j2ee container???
    Is it way you a stub?

  2. I'm not sure exactly what you don't understand here. When you call getHome() you get an object that implements the StoreAccessHome interface. When you invoke create() on this object you get an object that implements StoreAccess. Such an implementation is sometimes referred to as a "stub", because it is a local stub that represents (i.e. delegates requests to) the bean implementation (which is located on the server).