X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fsite%2Fxhtml%2Fpitfalls.xhtml;h=07438808fabacb653e5a5d134640fc3349f494af;hp=3d8c616406e1ddd97401d779c806dafc9b8cc0cc;hb=HEAD;hpb=2ec0af491d992d9c26000f803bbc61fdb1299318 diff --git a/src/site/xhtml/pitfalls.xhtml b/src/site/xhtml/pitfalls.xhtml index 3d8c6164..07438808 100644 --- a/src/site/xhtml/pitfalls.xhtml +++ b/src/site/xhtml/pitfalls.xhtml @@ -16,20 +16,19 @@

hibernate-maven-plugin always needs a database-connection

- 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 hibernate.schema.export to + If you do not need the generated SQL to be executed automatically, + you can set the property hibernate.schema.execute to false. This can be achieved with the command-line parameter - -Dhibernate.schema.export=false or with the following + -Dhibernate.schema.execute=false or with the following configuration:

 <configuration>
-  <export>false</export>
+  <execute>false</execute>
 </configuration>

But even when no database is to be created, hibernate always needs to know @@ -124,7 +123,7 @@

A quick fix to this problem is, to force - 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.

@@ -211,5 +210,42 @@ mvn hibernate:create -Dhibernate.schema.force=true You should consider to upgrade to the latest version of the plugin.

+

If two goals are specified, the second one is always skipped

+

+ If you specify two goals, for example drop and + create, each goal has to be specified in its own + execution, 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. +

+

+ Example configuration for two goals: +

+
+<executions>
+  <execution>
+    <id>Create Drop-Schema</id>
+    <phase>test-compile</phase>
+    <goals>
+      <goal>drop</goal>
+    </goals>
+    <configuration>
+      <outputFile>db-schema/drop-schema.ddl</outputFile>
+    </configuration>
+  </execution>
+  <execution>
+    <id>Create Create-Schema</id>
+    <phase>test-compile</phase>
+    <goals>
+      <goal>create</goal>
+    </goals>
+    <configuration>
+      <outputFile>db-schema/create-schema.ddl</outputFile>
+    </configuration>
+  </execution>
+</executions>