Which of the following is True about business interface of an EJB 3.0 bean? (Choose two) (Choose 2)
[A] The interface must not extend javax.ejb.EJBObject or javax.ejb.EJBLocalObject interfaces.
[B] The remote business interface must implement the java.rmi.Remote interface.
[C] The throws clause of the remote business interface method must throw java.rmi.RemoteException
[D] It is not mandatory to define whether the business interface is a Remote or Local interface
The correct answers are A and D.
It is correct, but why answer [C] is wrong?
And, the explanation says:
Is this correct? I don't remember anything like this from the specs.
The EJB 3.0 specification mandates that the methods of the business interface must not throw java.rmi.RemoteException.
With EJB3 the container will add this exception to the method so the developer doesn't have to do this in the code. This is done for making the development of EJB more easy.
public interface CreditCard implements java.rmi.Remote
methods of above interface must throws java.rmi.RemoteException
but if businees interface is like
public interface CreditCard
it is not mendatory for developer add throws RemoteException to methods
but since throws RemoteException is needed, so compiler does it for developer.