JPA-properties must be converted into Hibernate-properties explicitly
authorKai Moritz <kai@juplo.de>
Sun, 6 Nov 2016 13:37:01 +0000 (14:37 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 13 Nov 2016 16:37:15 +0000 (17:37 +0100)
src/it/tutorials/entitymanager/pom.xml
src/it/tutorials/envers/pom.xml
src/main/java/de/juplo/plugins/hibernate/AbstractSchemaMojo.java

index a68d790..9d740a5 100644 (file)
@@ -69,8 +69,6 @@
                     <scanTestClasses>true</scanTestClasses>
                     <dialect>org.hibernate.dialect.H2Dialect</dialect>
                     <format>true</format>
-                    <username>sa</username>
-                    <password></password>
                 </configuration>
             </plugin>
         </plugins>
index 7aaac61..f5d8769 100644 (file)
@@ -74,8 +74,6 @@
                     <scanTestClasses>true</scanTestClasses>
                     <dialect>org.hibernate.dialect.H2Dialect</dialect>
                     <format>true</format>
-                    <username>sa</username>
-                    <password></password>
                 </configuration>
             </plugin>
         </plugins>
index ff68ea7..9006f35 100644 (file)
@@ -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)