EJB.8.6 Entity Bean s Remote Interface


EJB.8.6 Entity Bean's Remote Interface

A client accesses 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 clients .

The following example illustrates the definition of an entity bean's remote interface:

 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 home interface for the entity object.

  • Remove the entity object.

  • Obtain the entity object's handle.

  • 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.

Note that the entity object does not expose the methods of the javax.ejb.EnterpriseBean interface to the client. These methods are not intended for the client ”they are used by the container to manage the enterprise bean instances.



Java 2 Platform, Enterprise Edition. Platform and Component Specifications
Java 2 Platform, Enterprise Edition: Platform and Component Specifications
ISBN: 0201704560
EAN: 2147483647
Year: 2000
Pages: 399

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net