This book discourages implementing the remote interface in the bean class. This makes it a little more difficult to enforce consistency between the business methods defined in the remote interface and the corresponding methods on the bean class. There are good reasons for not implementing the remote interface in the bean class, but there is also a need for a common interface to ensure that the bean class and remote interface define the same business methods. This section describes a design alternative that allows you to use a common interface to ensure consistency between the bean class and the remote interface.
There should be no difference, other than the missing
java.rmi.RemoteException, between the business
methods defined in the
ShipBean and their
corresponding business methods defined in the
interface. EJB requires you to match the method signatures so that
the remote interface can accurately represent the bean class on the
client. Why not implement the remote interface
com.titan.Ship in the
class to ensure that these methods are matched correctly?
EJB allows a bean class to implement its remote interface, but this
practice is discouraged for a couple of very good reasons. First, the
remote interface is actually an extension of the
javax.ejb.EJBObject interface, which you learned
about in Chapter 5. This interface defines several methods that are implemented by the EJB ...