From 47d6d65bbb18a5f23a5b67c2282e2090fab9e4a3 Mon Sep 17 00:00:00 2001 From: vramik Date: Mon, 20 Jan 2020 18:55:44 +0100 Subject: [PATCH] KEYCLOAK-12724 - workaround hibernate bug - set explicitly dialect for oracle version greater than 12 --- .../connections/jpa/DefaultJpaConnectionProviderFactory.java | 5 +++++ testsuite/integration-arquillian/pom.xml | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java b/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java index 5506ceb11f..169348e8c3 100755 --- a/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java +++ b/model/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java @@ -276,6 +276,11 @@ public class DefaultJpaConnectionProviderFactory implements JpaConnectionProvide return sql2012Dialect; } } + // For Oracle19c, we may need to set dialect explicitly to workaround https://hibernate.atlassian.net/browse/HHH-13184 + if (dbProductName.equals("Oracle") && connection.getMetaData().getDatabaseMajorVersion() > 12) { + logger.debugf("Manually specify dialect for Oracle to org.hibernate.dialect.Oracle12cDialect"); + return "org.hibernate.dialect.Oracle12cDialect"; + } } catch (SQLException e) { logger.warnf("Unable to detect hibernate dialect due database exception : %s", e.getMessage()); } diff --git a/testsuite/integration-arquillian/pom.xml b/testsuite/integration-arquillian/pom.xml index c7d7f0b506..3258c88165 100644 --- a/testsuite/integration-arquillian/pom.xml +++ b/testsuite/integration-arquillian/pom.xml @@ -581,7 +581,7 @@ - db-allocator-db-oracle12cR1RAC + db-allocator-db-oracleRAC @@ -589,7 +589,7 @@ com.oracle ojdbc8 12.2.0.1 - oracle12cR1RAC + oracle19cRAC false