With different types of beans, the client access mechanisms and views need to be formalized to reduce complexity and simplify maintenance. Clients can be instances of EJBs or other Web application components such as JSP, Java applets, and so on. To a client, a session bean is a non-persistent enterprise bean that encapsulates business logic, and an entity bean is an object-oriented (Java) representation of different types of persistent data (RDBMS and others).
Every bean has two interfaces that define the client access mechanisms: home and component interfaces. Together, these interfaces define the clients' view of enterprise beans. The bean container provides the implementation of these interfaces, but the container is transparent to the client.
A client can be either local or remote, and the client views (interfaces) to EJB are different depending on the client's location (local or remote). This means that if the client is local to the EJB, then the interfaces used by the client to access the EJB are different from the interfaces used by a remote client to access the same EJB. The remote client's view is composed of two interfaces: a remote interface and a remote home interface. These remote interfaces can be used by a client that can be running in the same Java Virtual Machine (JVM) or a different JVM on a different machine. The remote client view interfaces remain the same, and are independent of the location of the client. Both the remote and remote home interfaces are Java RMI-based (Remote Method Invocation-based).
If the client and the bean are both hosted in the same JVM, then the remote client view is an overhead that can be removed by a local client view. Similar to the remote client view, the local view is composed of a local interface and a local home interface.
Both the local and remote client views enable entity and session beans' maximum scalability and flexibility. Together with the capabilities of entity (independent of persistence mechanism) and session beans (stateful and stateless) and the client access views (local and remote), EJB form a strong foundation for distributed applications. JCA resource adapters can have EJB clients, or they can interact with EJB to fulfill some of its internal functions.