Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g (10.1.3.1.0) Part Number B28221-02 |
|
|
View PDF |
The component interfaces define the business methods of the bean that a client can invoke.
The entity bean component interface is the interface that the client can invoke its methods with. The component interface defines the business logic methods for the entity bean instance.
There are the following two types of component interface:
The remote component interface extends javax.ejb.EJBObject
(see "Implementing the Remote Component Interface")
The local component interface extends javax.ejb.EJBLocalObject
(see "Implementing the Local Component Interface")
The remote interface defines the business methods that a remote client can invoke. The requirements for developing the remote component interface include:
The remote component interface of the bean must extend the javax.ejb.EJBObject
interface, and its methods must throw the java.rmi.RemoteException
exception.
You must declare the remote interface and its methods as public
for remote clients.
The remote component interface, all its method parameters, and return types must be serializable. In general, any object that is passed between the client and the enterprise bean must be serializable, because RMI marshals and unmarshalls the object on both ends.
Any exception can be thrown to the client. Run-time exceptions, including EJBException
and RemoteException
, are transferred back to the client as remote run-time exceptions.
A remote component interface can throw a specified application exceptions.
Example 13-3 shows the remote component interface corresponding to the EJB 2.1 entity bean with container-managed persistence in Example 13-1 and Example 13-7 shows the remote component interface corresponding to the EJB 2.1 entity bean with bean-managed persistence in Example 13-5.