Describe in detail the relationship between the client and the EJB.
A client makes use of the services of a bean. In this lesson we look at the entities involved and how they enable this to happen.
The SlideShow below shows each of the entities involved in the sequence of operations. Each diagram illustrates the next step in the sequence, such that the client can:
The home interface is defined by the bean developer. However, by the time the bean instance is ready in the container, the deployment process will have created the home object class and the container will have instantiated it. The home object listens on the network. The stub downloaded from the Name Service is the stub to the home object.
The EJBObject object is a proxy for the bean. Do not confuse this proxy with the EJBObject stub, downloaded to the client, which is a proxy for the EJBObject itself. It is built at deployment time to make the bean's business methods available to the client. It is the part of the container that hides the actual bean instance from the client. The only access to the bean instance is through its specific EJBObject. This allows the container to interpose itself between the client's call and the invocation of the method.
The EJBObject also contains methods to remove beans, compare beans, and acquire a handle to the bean.
The home object is sometimes known as the bean factory .
- Handle: An object which contains all the information required to access an existing remote session bean.
- Bean factory: That part of an object monitor that is responsible for creating (manufacturing) the bean when required.
In the next lesson I will explain how you write the code for the home interface that is used by the container to build the home object.
In the next lesson, you will be introduced to the home object and the home interface it implements.