Explain exception handling support in Spring DAO?

Answered

Explain exception handling support in Spring DAO?

Ninja Asked on 19th September 2018 in Spring DAO.
Add Comment
1 Answer(s)
Best answer

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.

Ninja Answered on 19th September 2018.
Add Comment