From f92a01a5043d0ac2f6a8eaf5aeed6f724b102f34 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 6 Nov 2016 14:37:01 +0100 Subject: [PATCH] JPA-properties must be converted into Hibernate-properties explicitly --- src/it/tutorials/entitymanager/pom.xml | 2 - src/it/tutorials/envers/pom.xml | 2 - .../plugins/hibernate/AbstractSchemaMojo.java | 54 ++++++++++--------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/src/it/tutorials/entitymanager/pom.xml b/src/it/tutorials/entitymanager/pom.xml index a68d7908..9d740a5e 100644 --- a/src/it/tutorials/entitymanager/pom.xml +++ b/src/it/tutorials/entitymanager/pom.xml @@ -69,8 +69,6 @@ true org.hibernate.dialect.H2Dialect true - sa - diff --git a/src/it/tutorials/envers/pom.xml b/src/it/tutorials/envers/pom.xml index 7aaac615..f5d87692 100644 --- a/src/it/tutorials/envers/pom.xml +++ b/src/it/tutorials/envers/pom.xml @@ -74,8 +74,6 @@ true org.hibernate.dialect.H2Dialect true - sa - diff --git a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java index ff68ea73..9006f352 100644 --- a/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java +++ b/src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java @@ -960,50 +960,52 @@ public abstract class AbstractSchemaMojo extends AbstractMojo String alternativeKey ) { - value = configure(properties, value, key); - if (value == null) - return; + configure(properties, value, key); if (properties.containsKey(alternativeKey)) { - getLog().warn( - "Ignoring property " + alternativeKey + "=" + - properties.getProperty(alternativeKey) + " in favour for property " + - key + "=" + properties.getProperty(key) - ); - properties.remove(alternativeKey); + if (properties.containsKey(key)) + { + getLog().warn( + "Ignoring property " + alternativeKey + "=\"" + + properties.getProperty(alternativeKey) + + "\" in favour for property " + key + "=\"" + + properties.getProperty(key) + "\"" + ); + properties.remove(alternativeKey); + } + else + { + value = properties.getProperty(alternativeKey); + properties.remove(alternativeKey); + getLog().info( + "Using value \"" + value + "\" from property " + alternativeKey + + " for property " + key + ); + properties.setProperty(key, value); + } } } - private String configure(Properties properties, String value, String key) + private void configure(Properties properties, String value, String key) { if (value != null) { if (properties.containsKey(key)) - getLog().debug( - "Overwriting property " + key + "=" + properties.getProperty(key) + - " with the value " + value + getLog().info( + "Overwriting property " + key + "=\"" + + properties.getProperty(key) + + "\" with value \"" + value + "\"" ); else - getLog().debug("Using the value " + value + " for property " + key); + getLog().debug("Using value \"" + value + "\" for property " + key); properties.setProperty(key, value); } - return properties.getProperty(key); } private void configure(Properties properties, Boolean value, String key) { - if (value != null) - { - if (properties.containsKey(key)) - getLog().debug( - "Overwriting property " + key + "=" + properties.getProperty(key) + - " with the value " + value - ); - else - getLog().debug("Using the value " + value + " for property " + key); - properties.setProperty(key, value.toString()); - } + configure(properties, value == null ? null : value.toString(), key); } private File getOutputFile(String filename) -- 2.20.1