</executions>
<configuration>
<persistenceUnit>primary</persistenceUnit>
- <export>false</export>
+ <execute>false</execute>
<envers>true</envers>
<format>true</format>
<delimiter>;</delimiter>
</execution>
</executions>
<configuration>
- <export>false</export>
+ <execute>false</execute>
<envers>true</envers>
<format>true</format>
<delimiter>;</delimiter>
<version>@project.version@</version>
<configuration>
<!-- Generat schema only, no DB connection needed -->
- <export>false</export>
+ <execute>false</execute>
<format>true</format>
</configuration>
<executions>
__Rebuild the SQL-script using the Hibernate4-maven-plugin to create the database__
- mvn -PcreateHsqlDbScript clean compile hibernate:export
+ mvn -PcreateHsqlDbScript clean compile hibernate:create
__Build and run the integration tests__
</execution>
</executions>
<configuration>
- <export>false</export>
+ <execute>false</execute>
<driver>org.hsqldb.jdbc.JDBCDriver</driver>
<dialect>org.hibernate.dialect.HSQLDialect</dialect>
<envers>true</envers>
</execution>
</executions>
<configuration>
- <export>false</export>
+ <execute>false</execute>
<format>true</format>
<drop>false</drop>
<dialect>org.hibernate.dialect.PostgreSQL9Dialect</dialect>
<physicalNamingStrategy>ch.dvbern.demo.persistence.DemoPhysicalNamingStrategyImpl
</physicalNamingStrategy>
<!--verhindert, dass das Plugin versucht das schema physisch in eine DB zu schreiben-->
- <export>false</export>
+ <execute>false</execute>
<format>true</format>
<force>true</force>
<!--File in welches das Schema exportiert wird (defaultist create.sql)-->
</execution>
</executions>
<configuration>
- <export>false</export>
+ <execute>false</execute>
<format>true</format>
</configuration>
</plugin>
<version>@project.version@</version>
<configuration>
<!-- Gnerate schema only, no DB connection needed -->
- <export>false</export>
+ <execute>false</execute>
</configuration>
<executions>
<execution>
<configuration>
<url>jdbc:h2:mem:db1;MVCC=TRUE</url>
<format>true</format>
- <export>false</export>
+ <execute>false</execute>
</configuration>
</plugin>
</plugins>
*/
public abstract class AbstractSchemaMojo extends AbstractMojo
{
- public final static String EXPORT = "hibernate.schema.export";
+ public final static String EXECUTE = "hibernate.schema.execute";
public final static String OUTPUTDIRECTORY = "project.build.outputDirectory";
public final static String SCAN_CLASSES = "hibernate.schema.scan.classes";
public final static String SCAN_DEPENDENCIES = "hibernate.schema.scan.dependencies";
/** Parameters to configure the genaration of the SQL *********************/
/**
- * Export the database-schma to the database.
+ * Excecute the generated SQL.
* If set to <code>false</code>, only the SQL-script is created and the
* database is not touched.
* <p>
* it is not known by Hibernate nor JPA and, hence, not picked up from
* their configuration!
*
- * @parameter property="hibernate.schema.export" default-value="true"
+ * @parameter property="hibernate.schema.execute" default-value="true"
* @since 2.0
*/
- private Boolean export;
+ private Boolean execute;
/**
* Skip execution
private boolean skip;
/**
- * Force execution
+ * Force generation/execution
* <p>
- * Force execution, even if no modified or newly added annotated classes
- * where found and the dialect was not changed.
+ * Force the generation and (if configured) the execution of the SQL, even if
+ * no modified or newly added annotated classes where found and the
+ * configuration was not changed.
* <p>
* <code>skip</code> takes precedence over <code>force</code>.
* <p>
/** Skip execution, if mapping and configuration is unchanged */
if (!tracker.modified())
{
- getLog().info(
- "Mapping and configuration unchanged."
- );
+ getLog().info("Mapping and configuration unchanged.");
if (force)
- getLog().info("Schema generation is forced!");
+ getLog().info("Generation/execution is forced!");
else
{
getLog().info("Skipping schema generation!");
SchemaManagementToolCoordinator
.buildExecutionOptions(settings, handler);
final EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.SCRIPT);
- if (export)
+ if (execute)
targetTypes.add(TargetType.DATABASE);
TargetDescriptor target = new TargetDescriptor()
{
throws MojoFailureException
{
/**
- * Special treatment for the configuration-value "export": if it is
+ * Special treatment for the configuration-value "execute": if it is
* switched to "true", the genearation fo the schema should be forced!
*/
- if (tracker.check(EXPORT, export.toString()) && export)
+ if (tracker.check(EXECUTE, execute.toString()) && execute)
tracker.touch();
/**
The hibernate-maven-plugin computes MD5-sums for all found annotated
classes and stores them together with the generated schema.
If no classes were changed or added and the dialect wasn't changed too, it
- automatically skips the configured schema-export, to speed up the development
- cycle.
+ automatically skips the configured SQL-generation — and more
+ important in this respect — the execution of the generated SQL,
+ to speed up the development cycle.
</p>
<p>
The plugin signals, that the execution was skipped by setting the maven
</p>
<p>
Last but not least, in order to not slow down the development cycle, the
- hibernate-maven-plugin only executes the schema-export, if the mapping
- or the dialect changes (or if you force it to do so).
+ hibernate-maven-plugin only executes the generated SQL, if the mapping
+ or the configuration has changed (or if you force it to do so).
</p>
<p>
For more information about the inspiration to write this tiny plugin,
See <a href="./drop-mojo.html">hibernate:drop</a> and
<a href="./plugin-info.html">Plugin Documentation</a> for the full
autogenerated documentation. These are mostly configuration-options
- of the Hibernate-Tools <code>SchemaExport</code> and <code>SchemaUpdate</code>, that do
- the work in the background.
+ from the Hibernate-Tooling, that does the work in the background.
</li>
</ul>
<h2>Releases</h2>
</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">
<configuration>
- <export>false</export>
+ <execute>false</execute>
</configuration></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>