Implementing callback methods in the Bean class
1 posts in topic
Flat View  Flat View

Posted By:   Behrang_Saeedzadeh
Posted On:   Wednesday, July 17, 2002 04:48 AM

The javax.ejb.SessionBean interface declares four callback methods and a "throws java.rmi.RemoteException" is specified in these method declarations.

I am reading the Wrox Press' Java Server Programming J2EE 1.3 Editon and there's an example (OrderManagementBean) in the book that implements the SessionBean interface but does not throw a java.rmi.RemoteException from these callback methods.

My question is that do we have to throw the java.rmi.RemoteException from the implementation of callback methods in our Bean class, or not?

Thanks in advance.

Re: Implementing callback methods in the Bean class

Posted By:   Eric_Lindauer  
Posted On:   Wednesday, July 17, 2002 07:35 AM

You do not have to declare throws RemoteException in the method implementation. The point is that someone calling your implementation remotely may well get a RemoteException anyways, which is why the exception is declared in the interface. Anyone invoking a method through this interface ( that is, anyone making a remote call and not a local on your bean implementation ) will have to handle this exception, even if your implementation does not explicitly throw it.

Hope this helps.

About | Sitemap | Contact