Explain exception handling support in Spring DAO?
Explain exception handling support in Spring DAO?
Spring provides a convenient translation from technology-specific exceptions like SQLException to its own exception class hierarchy with the DataAccessException as the root exception. These exceptions wrap the original exception so that there is no loss of information.
Spring wraps JDBC exception and Hibernate-specific exceptions, converting them from proprietary, checked exceptions to a set of focused runtime exceptions. This allows one to handle most persistence exceptions, which are non-recoverable, only in the appropriate layers, without having much boilerplate catch-and-throw blocks and exception declarations in DAOs. This is true for the various template classes in Spring support for various ORM frameworks.