From 61cb18a69c4201770e1a5bd8223ec94c475ac7f7 Mon Sep 17 00:00:00 2001 From: tfeiner Date: Fri, 6 May 2016 16:26:48 +0200 Subject: [PATCH] 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 --- .../boot/autoconfigure/jooq/JooqExceptionTranslator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java index fbfa7192c6..ca0085a177 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/JooqExceptionTranslator.java @@ -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(); }