From fb8483dc56a69cea75593e047e0f2c6c0fefbf54 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Fri, 18 Jul 2014 11:32:09 +0100 Subject: [PATCH] Added support to specify dialect for JPA --- .../connections/jpa/DefaultJpaConnectionProviderFactory.java | 5 +++++ .../src/main/resources/META-INF/keycloak-server.json | 1 + 2 files changed, 6 insertions(+) diff --git a/connections/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java b/connections/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java index 3ce1667f16..e39877bd9b 100644 --- a/connections/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java +++ b/connections/jpa/src/main/java/org/keycloak/connections/jpa/DefaultJpaConnectionProviderFactory.java @@ -69,6 +69,11 @@ public class DefaultJpaConnectionProviderFactory implements JpaConnectionProvide properties.put(AvailableSettings.JDBC_URL, config.get("url")); properties.put(AvailableSettings.JDBC_DRIVER, config.get("driver")); + String driverDialect = config.get("driverDialect"); + if (driverDialect != null && driverDialect.length() > 0) { + properties.put("hibernate.dialect", driverDialect); + } + String user = config.get("user"); if (user != null) { properties.put(AvailableSettings.JDBC_USER, user); diff --git a/testsuite/integration/src/main/resources/META-INF/keycloak-server.json b/testsuite/integration/src/main/resources/META-INF/keycloak-server.json index 1547746abb..4d743491e7 100755 --- a/testsuite/integration/src/main/resources/META-INF/keycloak-server.json +++ b/testsuite/integration/src/main/resources/META-INF/keycloak-server.json @@ -60,6 +60,7 @@ "default": { "url": "${keycloak.connectionsJpa.url:jdbc:h2:mem:test}", "driver": "${keycloak.connectionsJpa.driver:org.h2.Driver}", + "driverDialect": "${keycloak.connectionsJpa.driverDialect:}", "user": "${keycloak.connectionsJpa.user:sa}", "password": "${keycloak.connectionsJpa.password:}", "databaseSchema": "${keycloak.connectionsJpa.databaseSchema:create-drop}"