X-Git-Url: https://juplo.de/gitweb/?p=hibernate4-maven-plugin;a=blobdiff_plain;f=src%2Fsite%2Fxhtml%2Fpitfalls.xhtml;h=07438808fabacb653e5a5d134640fc3349f494af;hp=d762b3aec0d30c71bdf8ea9897c30fa4f9da8102;hb=HEAD;hpb=0611db682bc69b80d8567bf9316668a1b6161725 diff --git a/src/site/xhtml/pitfalls.xhtml b/src/site/xhtml/pitfalls.xhtml index d762b3ae..07438808 100644 --- a/src/site/xhtml/pitfalls.xhtml +++ b/src/site/xhtml/pitfalls.xhtml @@ -4,6 +4,7 @@ +

Known Pitfalls (FAQ)

Annotated classes in dependencies are not found.

hibernate-maven-plugin by default scans dependencies in the scope @@ -15,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 @@ -123,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.

@@ -210,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>