-
Book Overview & Buying
-
Table Of Contents
Spring Essentials
By :
With traditional JDBC-based applications, exception handling is based on java.sql.SQLException, which is a checked exception. It forces the developer to write catch and finally blocks carefully for proper handling and to avoid resource leakages such as leaving a database connection open. Spring, with its smart exception hierarchy based on RuntimeException, spares the developer from this nightmare. Having DataAccessException as the root, Spring bundles a bit set of meaningful exceptions, translating the traditional JDBC exceptions. Spring also covers Hibernate, JPA, and JDO exceptions in a consistent manner.
Spring uses SQLErrorCodeExceptionTranslator, which inherits SQLExceptionTranslator for translating SQLException to DataAccessExceptions. We can extend this class to customize the default translations. We can replace the default translator with our custom implementation by injecting into the persistence resources (such as JdbcTemplate, to be...
Change the font size
Change margin width
Change background colour