/**
* Target of execution:
* <ul>
- * <li><strong>NONE</strong> do nothing - just validate the configuration (forces excecution, signals skip)</li>
- * <li><strong>EXPORT</strong> create database (<strong>DEFAULT!</strong>. forces excecution, signals skip)</li>
- * <li><strong>SCRIPT</strong> export schema to SQL-script</li>
+ * <li><strong>NONE</strong> only export schema to SQL-script (forces excecution, signals skip)</li>
+ * <li><strong>EXPORT</strong> create database (<strong>DEFAULT!</strong>). forces excecution, signals skip)</li>
+ * <li><strong>SCRIPT</strong> export schema to SQL-script and print it to STDOUT</li>
* <li><strong>BOTH</strong></li>
* </ul>
*
+ * A databaseconnection is only needed for EXPORT and BOTH, but a
+ * Hibernate-Dialect must always be choosen.
+ *
* @parameter property="hibernate.export.target" default-value="EXPORT"
*/
private String target;
* <li><strong>BOTH</strong> (<strong>DEFAULT!</strong>)</li>
* </ul>
*
+ * If NONE is choosen, no databaseconnection is needed.
+ *
* @parameter property="hibernate.export.type" default-value="BOTH"
*/
private String type;
* hibernate does not use the context-classloader of the current
* thread and, hence, would not be able to resolve the driver-class!
*/
+ getLog().debug("Target: " + target + ", Type: " + type);
switch (target)
{
case EXPORT:
Known Pitfalls
+* hibernate4-maven-plugin always needs a database-connection
+
+ The default-configuration uses the EXPORT-target of the SchemaExport-Tool.
+ If you do not need to create a database with the evaluated schema, you can
+ use the NONE- or the SCRIPT-target.
+ This can be achieved with the commandline-parameter
+ <<<-Dhibernate.export.target=SCRIPT>>> or with the following configuration:
+
+------------
+<configuration>
+ <target>SCRIPT</target>
+</configuration>
+------------
+
+ But even when no database is to be created, hibernate always needs to know
+ the dialect. Hence, the plugin will fail if this parameter is missing!
+
* Dependency for driver-class XYZ is missing
One regular problem is the scope of the jdbc-driver-dependency.
</configuration>
</plugin>
------------
+
+* The database will not be recreated after a manual drop/clean
+
+ If one manually drops the database or removes the hsqldb-files, it will not
+ be recreated by the hibernate4-maven-plugin, because it cannot detect, that
+ the database needs to be recreated.
+ This happens, because the plugin will not recreate the database if neither
+ the configuration nor the annotated classes have changed, because an
+ unnecessary drop-create-cycle might take a long time. The plugin will
+ report that like this:
+-------------
+[INFO] No modified annotated classes found and dialect unchanged.
+[INFO] Skipping schema generation!
+[------------
+
+ If one always uses <<<mvn clen>>> for cleanup, this will not happen.
+ Otherwise the recreation must be forced:
+
+-------------
+mvn hibernate4:export -Dhibernate.export.force=true
+-------------
<item name="Parameter Documentation" href="export-mojo.html"/>
<item name="Enable Debug-Output" href="debugging.html"/>
<item name="Force Exceution" href="force.html"/>
- <item name="Known Pitfalls" href="pitfalls.html"/>
+ <item name="Known Pitfalls (FAQ)" href="pitfalls.html"/>
</menu>
<menu ref="reports"/>
<breadcrumbs>