A client can access an entity object through the entity bean’s remote interface. An entity bean’s remote interface MUST extend the javax.ejb.EJBObject interface. A remote interface defines the business methods that are callable by remote clients.
public interface Account extends javax.ejb.EJBObject { void debit(double amount) throws java.rmi.RemoteException, InsufficientBalanceException; void credit(double amount) throws java.rmi.RemoteException; double getBalance() throws java.rmi.RemoteException; }
The javax.ejb.EJBObject interface defines the methods that allow the client to perform the following operations on an entity object’s reference:
Obtain the remote home interface for the entity object.
Remove the entity object.
Obtain the entity object’s handle (ONLY REMOTE objects have handles, LOCAL objects DO NOT have handles).
Obtain the entity object’s primary key.
The container provides the implementation of the methods defined in the javax.ejb.EJBObject interface. ONLY the BUSINESS methods are DELEGATED to the instances of the enterprise bean class.
public interface EJBObject extends Remote { EJBHome getEJBHome() throws RemoteException; Handle getHandle() throws RemoteException; Object getPrimaryKey() throws RemoteException; boolean isIdentical(EJBObject obj) throws RemoteException; void remove() throws RemoteException, RemoveException; }