posted 16 years ago
Hi Mandy,
I think that there is no way to avoid placing an object of type B that implements Remote in RmiRegistry. The whole point is that your client must not deal with RemoteExceptions in its code, because it must be transparent for the client if the datbase is local or remote . Here helps the Adapter pattern.
You create a class DBAdapter that implements DBMain and receives a B object in the constructor for example. Then it implements the methods of the DBMain interface delegating to the the B class. The problem is here handling of RemoteExceptions that must obey the DBMain contract. There were some discussion regarding this matter on this forum also. There are solutions like setting the RemoteExceptions as cause of RecordNotFoundException or simply logging the exception and returning the null where is possible..
This is my understanding of the problem, I hope that helps...
Best regards,
Liviu
[ August 01, 2007: Message edited by: Liviu Carausu ]
Oracle Certified Master Java SE6 Developer(SCJD),
OCE JEE 6 JSP and Servlets Developer,
Java EE6 Java Server Faces Developer.