projects
/
hibernate4-maven-plugin
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
03ed4ea
)
Cleaned up code (formatting and logical code-order)
vtatai
author
Kai Moritz
<kai@juplo.de>
Sat, 7 Sep 2013 20:56:10 +0000
(22:56 +0200)
committer
Kai Moritz
<kai@juplo.de>
Sat, 7 Sep 2013 21:03:39 +0000
(23:03 +0200)
src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
patch
|
blob
|
history
diff --git
a/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
b/src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
index
246f585
..
a7eab4c
100644
(file)
--- a/
src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
+++ b/
src/main/java/de/juplo/plugins/hibernate4/Hbm2DdlMojo.java
@@
-199,6
+199,13
@@
public class Hbm2DdlMojo extends AbstractMojo
*/
private String hibernateDialect;
*/
private String hibernateDialect;
+ /**
+ * Generate envers schema for auditing tables.
+ *
+ * @parameter expression="${hibernate.export.envers}" default-value="false"
+ */
+ private Boolean envers;
+
/**
* Path to Hibernate configuration file.
*
/**
* Path to Hibernate configuration file.
*
@@
-251,12
+258,6
@@
public class Hbm2DdlMojo extends AbstractMojo
*/
private boolean format;
*/
private boolean format;
- /**
- * Generate envers schema for auditing tables.
- *
- * @parameter expression="${hibernate.export.envers}" default-value="false"
- */
- private Boolean envers;
@Override
public void execute()
@Override
public void execute()
@@
-492,6
+493,19
@@
public class Hbm2DdlMojo extends AbstractMojo
getLog().debug("Using the value " + hibernateDialect);
properties.setProperty(DIALECT, hibernateDialect);
}
getLog().debug("Using the value " + hibernateDialect);
properties.setProperty(DIALECT, hibernateDialect);
}
+ if (envers != null)
+ {
+ if (properties.containsKey(ENVERS))
+ getLog().debug(
+ "Overwriting property " +
+ ENVERS + "=" + properties.getProperty(ENVERS) +
+ " with the value " + envers
+ );
+ else
+ getLog().debug("Using the value " + envers);
+ properties.setProperty(ENVERS, envers.toString());
+ }
+
/** The generated SQL varies with the dialect! */
if (md5s.containsKey(DIALECT))
/** The generated SQL varies with the dialect! */
if (md5s.containsKey(DIALECT))
@@
-512,14
+526,15
@@
public class Hbm2DdlMojo extends AbstractMojo
md5s.put(DIALECT, properties.getProperty(DIALECT));
}
md5s.put(DIALECT, properties.getProperty(DIALECT));
}
+ /** The generated SQL varies with the envers-configuration! */
if (md5s.containsKey(ENVERS))
{
String envers = properties.getProperty(ENVERS);
if (md5s.get(ENVERS).equals(envers))
if (md5s.containsKey(ENVERS))
{
String envers = properties.getProperty(ENVERS);
if (md5s.get(ENVERS).equals(envers))
- getLog().debug("Envers unchanged.");
+ getLog().debug("Envers
-configuration
unchanged.");
else
{
else
{
- getLog().debug("Envers changed: " + envers);
+ getLog().debug("Envers
-configuration
changed: " + envers);
modified = true;
md5s.put(ENVERS, envers.toString());
}
modified = true;
md5s.put(ENVERS, envers.toString());
}
@@
-530,18
+545,6
@@
public class Hbm2DdlMojo extends AbstractMojo
md5s.put(ENVERS, properties.getProperty(ENVERS));
}
md5s.put(ENVERS, properties.getProperty(ENVERS));
}
- if (envers != null) {
- if (properties.containsKey(ENVERS))
- getLog().debug(
- "Overwriting property " +
- ENVERS + "=" + properties.getProperty(ENVERS) +
- " with the value " + envers
- );
- else
- getLog().debug("Using the value " + envers);
- properties.setProperty(ENVERS, envers.toString());
- }
-
if (properties.isEmpty())
{
getLog().error("No properties set!");
if (properties.isEmpty())
{
getLog().error("No properties set!");
@@
-556,6
+559,13
@@
public class Hbm2DdlMojo extends AbstractMojo
getLog().debug("Class " + annotatedClass);
config.addAnnotatedClass(annotatedClass);
}
getLog().debug("Class " + annotatedClass);
config.addAnnotatedClass(annotatedClass);
}
+ if ("true".equals(properties.getProperty(ENVERS)))
+ {
+ config.buildMappings();
+ getLog().debug("Using envers");
+ AuditConfiguration.getFor(config);
+ }
+
Target target = null;
try
Target target = null;
try
@@
-663,13
+673,6
@@
public class Hbm2DdlMojo extends AbstractMojo
*/
Thread.currentThread().setContextClassLoader(classLoader);
*/
Thread.currentThread().setContextClassLoader(classLoader);
- config.buildMappings();
- if ("true".equals(properties.getProperty(ENVERS)))
- {
- getLog().debug("Using envers");
- AuditConfiguration.getFor(config);
- }
-
SchemaExport export = new SchemaExport(config, connection);
export.setOutputFile(outputFile);
export.setDelimiter(delimiter);
SchemaExport export = new SchemaExport(config, connection);
export.setOutputFile(outputFile);
export.setDelimiter(delimiter);