
Enterprise beans can be accessed by a variety of client applications:
Typically, session beans serve as clients for the entity beans in an EJB application.
The session and entity enterprise beans provide either a local, or a remote client view, or both. The differences between local and remote access to the enterprise beans are:
| Local Access | Remote Access |
|---|---|
|
The clients must reside in the same Java Virtual Machine (JVM) |
The clients may reside in a different Java Virtual Machine (JVM) |
|
The bean must have a local and a local home interface |
The bean must have a remote and a remote home interface |
|
Provides better performance |
May generate a significant overhead if the bean is frequently accessed |
|
Beans that provide local view can be accessed by:
These beans cannot be accessed by J2EE application clients. |
Beans that provide remote view can be accessed by:
|
|
The arguments of the methods of the bean's interfaces are passed by reference. |
The arguments of the methods of the bean's interfaces are passed by value. |
|
There are no restrictions for the type of the objects that are passed as parameters of the bean's methods |
The objects that are passed as parameters of the bean's methods must be correct RMI-IIOP types |
|
Fine-grained objects (usually entity beans) are typically accessed locally |
Coarse-grained objects (usually session beans) are typically accessed remotely |
|
Entity beans with container-managed persistence, which are in relationships with other container-managed beans, must provide a local view |
-- |
For more information how to access session and entity enterprise beans, see Looking Up Enterprise Beans .
Message-driven beans are not accessed through interfaces. For more information about access to message-driven beans, see Developing Message-Driven Beans .