Use JOOQ's Spring DB name during exception translation

The name of a JOOQ SQLDialect does not always match the name defined
in sql-error-codes.xml. For example, the Postgres translator was not
initialized correctly because in JOOQ the dialect is named
SQLDialect.POSTGRES, but in sql-error-codes.xml the bean is named
"PostgreSQL".

This commit updates the translator to use the dialects third-party
springDbName which ensures that it maps correctly to the entries in
sql-error-codes.xml.

Closes gh-5884
pull/5887/merge
tfeiner 9 years ago committed by Andy Wilkinson
parent 8cbbb577a0
commit 61cb18a69c

@ -58,7 +58,7 @@ class JooqExceptionTranslator extends DefaultExecuteListener {
private SQLExceptionTranslator getTranslator(ExecuteContext context) {
SQLDialect dialect = context.configuration().dialect();
if (dialect != null) {
return new SQLErrorCodeSQLExceptionTranslator(dialect.name());
return new SQLErrorCodeSQLExceptionTranslator(dialect.thirdParty().springDbName());
}
return new SQLStateSQLExceptionTranslator();
}

Loading…
Cancel
Save