Hi all,
At database design I used Adapter
pattern and came out with the following issue.
Should adapter class throw a general exception such as DatabaseException, or should it specify thrown exceptions ( ex: SecurityException, recordNotFoundException,..).
The problem with specified exception, it is hard to define all exceptions should be thrown by a method, and even if I could, it will be a long list.
Ex: Update method
With assignment database class, this method will throw RecordNotfoundException and SecurityException. On another database implementation it could throw new exceptions such as InvaildDataType, ColumnNotFoud, TableNotFound�..
So should the Adapter class throws a general exception, or throw every expected exception.
I am some how with throwing a general exception, what comfort me more about this choice is how
JDBC API works, where it throws a general SQL Exceptions.
I know we are talking about totally deferent approach with JDBC since the main idea in JDBC is to execute SQL statements, and not calling database methods, but at the end the results are the same.
Any comment is appreciated.
Best regards.