7.3. The Component Interface

The Component Interface is the client's view of an instance of the Session Bean. This interface contains the business methods of the Enterprise Bean. If it is remote, the interface must extend the javax.ejb.EJBObject interface; if it is local, the interface must extend the javax.ejb.EJBLocalObject interface. The methods defined in a remote component interface must follow the rules for Java RMI (this means that their arguments and return value must be valid types for Java RMI, and their throws clause must include the java.rmi.RemoteException). For each method defined in the component interface, there must be a matching method in the enterprise Bean's class (same name, same arguments number and types, same return type, and same exception list, except for RemoteException).

7.3.1. Example:

public interface Op extends EJBObject {
    public void buy (int Shares)  throws RemoteException;
    public int  read ()           throws RemoteException;
}

The same type of component interface could be defined as a local interface (even if it is not considered good design to define the same interface as both local and remote):

public interface LocalOp extends EJBLocalObject {
    public void buy (int Shares);
    public int  read ();
}