The client of an entity bean may be a REMOTE client or the client may be a LOCAL client.
A REMOTE client accesses an entity bean through the entity bean’s remote and remote home interfaces. The remote and remote home interfaces of the entity bean provide the remote client view.
The remote client view of an entity bean is location independent. A client running in the same JVM as an entity bean instance uses the same API to access the entity bean as a client running in a different JVM on the same or different machine.
A LOCAL client accesses an entity bean through the entity bean’s local and local home interfaces. The container provides classes that implement the entity bean’s local and local home interfaces. The objects that implement the local home and local interfaces are local Java objects.
The arguments of the methods of the LOCAL interface and LOCAL HOME interface are passed by REFERENCE.
The arguments and results of the methods of the REMOTE interface and REMOTE HOME interface are passed by VALUE.
The remote client view can also be mapped to non-Java client environments, such as CORBA clients not written in the Java programming language.
Locating an entity bean’s REMOTE home interface
Context initialContext = new InitialContext(); AccountRemoteHome accountHome = (AccountRemoteHome) javax.rmi.PortableRemoteObject.narrow( initialContext.lookup(?java:comp/env/ejb/accounts?), AccountRemoteHome.class );
Locating an entity bean’s LOCAL home interface
Context initialContext = new InitialContext(); AccountLocalHome accountHome = (AccountLocalHome) initialContext.lookup(?java:comp/env/ejb/accounts?);
The CONTAINER provides the implementation of the remote home interface for each entity bean deployed in the container that defines a remote home interface. The container makes the remote home interface accessible to the clients through JNDI. The entity bean’s remote home interface allows a client to do the following:
Create new entity objects within the home.
Find existing entity objects within the home.
Remove an entity object from the home.
Execute a home business method.
Get the javax.ejb.EJBMetaData interface for the entity bean. The javax.ejb.EJBMetaData interface is intended to allow application assembly tools to discover the meta-data information about the entity bean. The meta-data information allows loose client/server binding and scripting.
Obtain a HANDLE for the home interface. The home handle can be serialized and written to stable storage; later, possibly in a different JVM, the handle can be deserialized from stable storage and used to obtain a reference to the home interface.
The CONTAINER provides the implementation of the local home interface for each entity bean deployed in the container that defines a local home interface. The container makes the local home interface accessible to local clients through JNDI.
The entity bean’s LOCAL home interface allows a local client to do the following:
Create new entity objects within the home.
Find existing entity objects within the home.
Remove an entity object from the home.
Execute a home business method.
Visit http://java.boot.by for the updates.