background image

Local Clients

<< Defining Client Access with Interfaces | Deciding on Remote or Local Access >>
<< Defining Client Access with Interfaces | Deciding on Remote or Local Access >>

Local Clients

To create an enterprise bean that allows remote access, you must do one of the following:
Decorate the business interface of the enterprise bean with the @Remote annotation:
@Remote
public interface InterfaceName { ... }
Decorate the bean class with @Remote, specifying the business interface or interfaces:
@Remote(InterfaceName.class)
public class BeanName implements InterfaceName { ... }
The remote interface defines the business and life cycle methods that are specific to the bean. For
example, the remote interface of a bean named BankAccountBean might have business methods
named deposit and credit.
Figure 20­1
shows how the interface controls the client's view of
an enterprise bean.
Local Clients
A local client has these characteristics:
It must run in the same JVM as the enterprise bean it accesses.
It can be a web component or another enterprise bean.
To the local client, the location of the enterprise bean it accesses is not transparent.
Remote Client
Remote
Interface
deposit()
credit()
BankAccountBean
FIGURE 20­1
Interfaces for an Enterprise Bean with Remote Access
Defining Client Access with Interfaces
Chapter 20 · Enterprise Beans
637