Added a FAQ-entry, that explains the configuration of two goals
[hibernate4-maven-plugin] / src / site / xhtml / pitfalls.xhtml
index d762b3a..0743880 100644 (file)
@@ -4,6 +4,7 @@
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  </head>
  <body>
+  <header><h1>Known Pitfalls (FAQ)</h1></header>
   <h2>Annotated classes in dependencies are not found.</h2>
   <p>
   hibernate-maven-plugin by default scans dependencies in the scope
   </p>
   <h2>hibernate-maven-plugin always needs a database-connection</h2>
   <p>
-  The default-configuration exports the created schema to the configured
-  database.
+  The default-configuration executes the created SQL.
   Therefore, it needs a valid database-connection and fails, if none is
   available.
-  If you do not need to export the created schema to a database,
-  you can set the property <code>hibernate.schema.export</code> to
+  If you do not need the generated SQL to be executed automatically,
+  you can set the property <code>hibernate.schema.execute</code> to
   <code>false</code>.
   This can be achieved with the command-line parameter
-  <code>-Dhibernate.schema.export=false</code> or with the following
+  <code>-Dhibernate.schema.execute=false</code> or with the following
   configuration:
   </p>
   <pre class="prettyprint linenums lang-html">
 &lt;configuration&gt;
-  &lt;export&gt;false&lt;/export&gt;
+  &lt;execute&gt;false&lt;/execute&gt;
 &lt;/configuration&gt;</pre>
   <p>
   But even when no database is to be created, hibernate always needs to know
   </p>
   <p>
   A quick fix to this problem is, to <a href="./force.html">force</a>
-  hibernate-maven-plugin to export the schema every time it is running.
+  hibernate-maven-plugin to generate and execute the SQL every time it is running.
   But to recreate the database on every testrun may noticeable slow down your
   development cycle, if you have to wait for slow IO.
   </p>
@@ -210,5 +210,42 @@ mvn hibernate:create -Dhibernate.schema.force=true</pre>
       You should consider to upgrade to the latest version of the plugin.
     </strong>
   </p>
+  <h2>If two goals are specified, the second one is always skipped</h2>
+  <p>
+    If you specify two goals, for example <code>drop</code> and
+    <code>create</code>, each goal has to be specified in its own
+    <code>execution</code>, so that you can specify two different
+    output-files for the two goals.
+    Otherwise, both goals will use the same output-file and the goal, that
+    is run second, will always skip, becaus it will find, that the output
+    file already exists and conclude, that its work was already done in a
+    prior run.
+  </p>
+  <p>
+    Example configuration for two goals:
+  </p>
+  <pre class="prettyprint linenums lang-html">
+&lt;executions&gt;
+  &lt;execution&gt;
+    &lt;id&gt;Create Drop-Schema&lt;/id&gt;
+    &lt;phase&gt;test-compile&lt;/phase&gt;
+    &lt;goals&gt;
+      &lt;goal&gt;drop&lt;/goal&gt;
+    &lt;/goals&gt;
+    &lt;configuration&gt;
+      &lt;outputFile&gt;db-schema/drop-schema.ddl&lt;/outputFile&gt;
+    &lt;/configuration&gt;
+  &lt;/execution&gt;
+  &lt;execution&gt;
+    &lt;id&gt;Create Create-Schema&lt;/id&gt;
+    &lt;phase&gt;test-compile&lt;/phase&gt;
+    &lt;goals&gt;
+      &lt;goal&gt;create&lt;/goal&gt;
+    &lt;/goals&gt;
+    &lt;configuration&gt;
+      &lt;outputFile&gt;db-schema/create-schema.ddl&lt;/outputFile&gt;
+    &lt;/configuration&gt;
+  &lt;/execution&gt;
+&lt;/executions&gt;</pre>
  </body>
 </html>