Please feel free to comment if my approach is acceptable: I create a database interface (DBInterface) containing all the public methods of the data class, each of which throws an Exception. For local database connection, I create a local database interface (LocalDBInterface) that extends DBInterface. This LocalDBInterface have the same list of methods as the DBInterface except it throws more specific exceptions like IOException and DatabaseException. I also create a remote database interface (RemoteDBInterface) that extends DBInterface. This RemoteDBInterface have the same list of methods as the DBInterface except it throws more specific exceptions like RemoteException, which is for RMI. In my coding, I have a lot of places throwing the general exception, i.e. Exception whenever calling the data class method is required. Using this approach, I do not need to duplicate the effort of coding the remote data access which is identical to the data class implementation.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads