Skip to content

pbzdyl/sqlex-mapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sqlex-mapper

Map java.sql.SQLException to a more meaningful exceptions hierarchy

Exception handling in JDBC is not easy. It provides base java.sql.SQLException with getSQLState and getErrorCode information but it's vendor specific and cumbersome to use. Yes, JDBC 4 (since Java 6) provides some improvements (additional exception hierarchy including classes like java.sql.SQLIntegrityConstraintViolationException etc.). Unfortunately not all SQL vendors catched up with those improvements (e.g. PostgreSQL still uses a single class for all kinds of errors).

This projects borrows the idea and code from Spring Framework. It provides simplified version of SQLExceptionTranslator - SqlExceptionMapper.

The default implementation of SqlExceptionMapper provides translation similar to SQLErrorCodeSQLExceptionTranslator and uses the same error codes mapping.

This is a very early version and API can still change.

Credits

Big 'thank you' goes to Spring Framework team for their implementation.

License

This project is released under version 2.0 of the [Apache License][].

About

java.sql.SQLException mapping

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages