1 package ejava.examples.daoex.dao;
2
3 /**
4 * This is the base exception for example DAOs. Note the design
5 * decision that needs to be made between a checked Exception and
6 * an unchecked RuntimeException. By using checked Exceptions you
7 * are requiring all interfacing code to deal with the exception --
8 * even if it cannot correct it. By using unchecked RuntimeExceptions
9 * the interfacing business code can be written cleaner by not
10 * being polluted with infrastructure exceptions.
11 */
12 public class DAOException extends RuntimeException {
13 private static final long serialVersionUID = 1L;
14 public DAOException() {}
15 public DAOException(String message) { super(message); }
16
17 //be wary of the exceptions that carry along infrastructure
18 //exceptions. Care should be taken higher up in the architecture
19 //to fully process these exceptions locally and not propogate
20 //the lower level exceptions to RMI clients. Classpath issues
21 //can occur at that point.
22
23 public DAOException(String message, Throwable rootCause) {
24 super(message, rootCause);
25 }
26 public DAOException(Throwable rootCause) {
27 super(rootCause);
28 }
29 }