8.3. The Component Interface

8.3.1. Business Methods

The Component Interface is the client's view of an instance of the Entity Bean. It is what is returned to the client by the Home interface after creating or finding an Entity Bean instance. This interface contains the business methods of the Enterprise Bean. The interface must extend the javax.ejb.EJBObject interface if it is remote, or the javax.ejb.EJBLocalObject if it is local. The methods of a remote component interface must follow the rules for Java RMI. For each method defined in this component interface, there must be a matching method of the bean implementation class (same arguments number and types, same return type, same exceptions except for RemoteException).

8.3.1.1. Component Interface Example

public interface Account extends EJBObject {
    public double getBalance() throws RemoteException;
    public void setBalance(double d) throws RemoteException;
    public String getCustomer() throws RemoteException;
    public void setCustomer(String c) throws RemoteException;
    public int getNumber() throws RemoteException;
}