3 <!-- Generated by Apache Maven Doxia Site Renderer 1.7.1 at 2017-06-02 -->
27 <!-- NEW PAGE - - - - - uri: integration.html -->
39 <!-- NEW PAGE - - - - - uri: dependencies.html -->
51 <!-- NEW PAGE - - - - - uri: dependency-info.html -->
63 <!-- NEW PAGE - - - - - uri: distribution-management.html -->
75 <!-- NEW PAGE - - - - - uri: index.html -->
87 <!-- NEW PAGE - - - - - uri: license.html -->
99 <!-- NEW PAGE - - - - - uri: plugin-management.html -->
111 <!-- NEW PAGE - - - - - uri: plugins.html -->
123 <!-- NEW PAGE - - - - - uri: team-list.html -->
135 <!-- NEW PAGE - - - - - uri: source-repository.html -->
147 <!-- NEW PAGE - - - - - uri: project-summary.html -->
154 <!-- NEW PAGE - - - - - uri: project-info.html -->
171 <!-- NEW PAGE - - - - - uri: testapidocs/index.html -->
183 <!-- NEW PAGE - - - - - uri: apidocs/index.html -->
195 <!-- NEW PAGE - - - - - uri: xref/index.html -->
207 <!-- NEW PAGE - - - - - uri: xref-test/index.html -->
219 <!-- NEW PAGE - - - - - uri: cpd.html -->
231 <!-- NEW PAGE - - - - - uri: pmd.html -->
243 <!-- NEW PAGE - - - - - uri: plugin-info.html -->
250 <!-- NEW PAGE - - - - - uri: project-reports.html -->
255 <!-- DONE WITH MENUE - - $page.name-->
270 <!-- OVERWRITING PAGE - uri: index.html -->
282 <!-- NEW PAGE - - - - - uri: configuration.html -->
294 <!-- NEW PAGE - - - - - uri: create-mojo.html -->
306 <!-- NEW PAGE - - - - - uri: drop-mojo.html -->
318 <!-- NEW PAGE - - - - - uri: debugging.html -->
330 <!-- NEW PAGE - - - - - uri: skip.html -->
342 <!-- NEW PAGE - - - - - uri: force.html -->
354 <!-- NEW PAGE - - - - - uri: pitfalls.html -->
366 <!-- OVERWRITING PAGE - uri: project-info.html -->
378 <!-- OVERWRITING PAGE - uri: project-reports.html -->
383 <!-- DONE WITH MENUE - - (no name)-->
387 <!-- name: Configuration Examples -->
388 <!-- title: Hibernate Maven Plugin – -->
389 <!-- short title: -->
390 <!-- current page: configuration.html -->
391 <!-- path: /hibernate-maven-plugin/ -->
392 <!-- crumbs: {"uri":"/projects.html","name":"Projects"} -->
393 <!-- pages: {integration.html={name=CI Management, uri=integration.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=integration.html, name=CI Management}]}, dependencies.html={name=Dependencies, uri=dependencies.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=dependencies.html, name=Dependencies}]}, dependency-info.html={name=Dependency Information, uri=dependency-info.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=dependency-info.html, name=Dependency Information}]}, distribution-management.html={name=Distribution Management, uri=distribution-management.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=distribution-management.html, name=Distribution Management}]}, index.html={name=Overview, uri=index.html, childs={index.html=Overview, configuration.html=Configuration Examples, create-mojo.html=Goal: CREATE, drop-mojo.html=Goal: DROP, debugging.html=Enable Debugging-Output, skip.html=Skipping Execution, force.html=Force Exceution, pitfalls.html=Known Pitfalls (FAQ), project-info.html=Project Information, project-reports.html=Project Reports}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=index.html, name=Overview}]}, license.html={name=Licenses, uri=license.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=license.html, name=Licenses}]}, plugin-management.html={name=Plugin Management, uri=plugin-management.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=plugin-management.html, name=Plugin Management}]}, plugins.html={name=Plugins, uri=plugins.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=plugins.html, name=Plugins}]}, team-list.html={name=Team, uri=team-list.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=team-list.html, name=Team}]}, source-repository.html={name=Source Code Management, uri=source-repository.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=source-repository.html, name=Source Code Management}]}, project-summary.html={name=Summary, uri=project-summary.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}, {uri=project-summary.html, name=Summary}]}, project-info.html={name=Project Information, uri=project-info.html, childs={integration.html=CI Management, dependencies.html=Dependencies, dependency-info.html=Dependency Information, distribution-management.html=Distribution Management, index.html=About, license.html=Licenses, plugin-management.html=Plugin Management, plugins.html=Plugins, team-list.html=Team, source-repository.html=Source Code Management, project-summary.html=Summary}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-info.html, name=Project Information}]}, testapidocs/index.html={name=Test JavaDocs, uri=testapidocs/index.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=testapidocs/index.html, name=Test JavaDocs}]}, apidocs/index.html={name=JavaDocs, uri=apidocs/index.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=apidocs/index.html, name=JavaDocs}]}, xref/index.html={name=Source Xref, uri=xref/index.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=xref/index.html, name=Source Xref}]}, xref-test/index.html={name=Test Source Xref, uri=xref-test/index.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=xref-test/index.html, name=Test Source Xref}]}, cpd.html={name=CPD, uri=cpd.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=cpd.html, name=CPD}]}, pmd.html={name=PMD, uri=pmd.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=pmd.html, name=PMD}]}, plugin-info.html={name=Plugin Documentation, uri=plugin-info.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}, {uri=plugin-info.html, name=Plugin Documentation}]}, project-reports.html={name=Project Reports, uri=project-reports.html, childs={testapidocs/index.html=Test JavaDocs, apidocs/index.html=JavaDocs, xref/index.html=Source Xref, xref-test/index.html=Test Source Xref, cpd.html=CPD, pmd.html=PMD, plugin-info.html=Plugin Documentation}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=project-reports.html, name=Project Reports}]}, configuration.html={name=Configuration Examples, uri=configuration.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=configuration.html, name=Configuration Examples}]}, create-mojo.html={name=Goal: CREATE, uri=create-mojo.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=create-mojo.html, name=Goal: CREATE}]}, drop-mojo.html={name=Goal: DROP, uri=drop-mojo.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=drop-mojo.html, name=Goal: DROP}]}, debugging.html={name=Enable Debugging-Output, uri=debugging.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=debugging.html, name=Enable Debugging-Output}]}, skip.html={name=Skipping Execution, uri=skip.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=skip.html, name=Skipping Execution}]}, force.html={name=Force Exceution, uri=force.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=force.html, name=Force Exceution}]}, pitfalls.html={name=Known Pitfalls (FAQ), uri=pitfalls.html, childs={}, crumbs=[{uri=index.html, name=Hibernate Maven Plugin}, {uri=pitfalls.html, name=Known Pitfalls (FAQ)}]}} -->
398 xmlns="http://www.w3.org/1999/xhtml"
399 xmlns:layout="http://www.thymeleaf.org"
400 layout:decorator="templates/layout"
402 uri='/hibernate-maven-plugin/configuration.html',
403 json='merge:{"pages":{"/hibernate-maven-plugin/integration.html":{"name":"CI Management","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/integration.html","name":"CI Management"}]},"/hibernate-maven-plugin/dependencies.html":{"name":"Dependencies","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/dependencies.html","name":"Dependencies"}]},"/hibernate-maven-plugin/dependency-info.html":{"name":"Dependency Information","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/dependency-info.html","name":"Dependency Information"}]},"/hibernate-maven-plugin/distribution-management.html":{"name":"Distribution Management","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/distribution-management.html","name":"Distribution Management"}]},"/hibernate-maven-plugin/index.html":{"name":"Overview","childs":{"/hibernate-maven-plugin/index.html":"Overview","/hibernate-maven-plugin/configuration.html":"Configuration Examples","/hibernate-maven-plugin/create-mojo.html":"Goal: CREATE","/hibernate-maven-plugin/drop-mojo.html":"Goal: DROP","/hibernate-maven-plugin/debugging.html":"Enable Debugging-Output","/hibernate-maven-plugin/skip.html":"Skipping Execution","/hibernate-maven-plugin/force.html":"Force Exceution","/hibernate-maven-plugin/pitfalls.html":"Known Pitfalls (FAQ)","/hibernate-maven-plugin/project-info.html":"Project Information","/hibernate-maven-plugin/project-reports.html":"Project Reports"},"crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/index.html","name":"Overview"}]},"/hibernate-maven-plugin/license.html":{"name":"Licenses","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/license.html","name":"Licenses"}]},"/hibernate-maven-plugin/plugin-management.html":{"name":"Plugin Management","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/plugin-management.html","name":"Plugin Management"}]},"/hibernate-maven-plugin/plugins.html":{"name":"Plugins","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/plugins.html","name":"Plugins"}]},"/hibernate-maven-plugin/team-list.html":{"name":"Team","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/team-list.html","name":"Team"}]},"/hibernate-maven-plugin/source-repository.html":{"name":"Source Code Management","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/source-repository.html","name":"Source Code Management"}]},"/hibernate-maven-plugin/project-summary.html":{"name":"Summary","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"},{"uri":"/hibernate-maven-plugin/project-summary.html","name":"Summary"}]},"/hibernate-maven-plugin/project-info.html":{"name":"Project Information","childs":{"/hibernate-maven-plugin/integration.html":"CI Management","/hibernate-maven-plugin/dependencies.html":"Dependencies","/hibernate-maven-plugin/dependency-info.html":"Dependency Information","/hibernate-maven-plugin/distribution-management.html":"Distribution Management","/hibernate-maven-plugin/index.html":"About","/hibernate-maven-plugin/license.html":"Licenses","/hibernate-maven-plugin/plugin-management.html":"Plugin Management","/hibernate-maven-plugin/plugins.html":"Plugins","/hibernate-maven-plugin/team-list.html":"Team","/hibernate-maven-plugin/source-repository.html":"Source Code Management","/hibernate-maven-plugin/project-summary.html":"Summary"},"crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-info.html","name":"Project Information"}]},"/hibernate-maven-plugin/testapidocs/index.html":{"name":"Test JavaDocs","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/testapidocs/index.html","name":"Test JavaDocs"}]},"/hibernate-maven-plugin/apidocs/index.html":{"name":"JavaDocs","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/apidocs/index.html","name":"JavaDocs"}]},"/hibernate-maven-plugin/xref/index.html":{"name":"Source Xref","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/xref/index.html","name":"Source Xref"}]},"/hibernate-maven-plugin/xref-test/index.html":{"name":"Test Source Xref","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/xref-test/index.html","name":"Test Source Xref"}]},"/hibernate-maven-plugin/cpd.html":{"name":"CPD","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/cpd.html","name":"CPD"}]},"/hibernate-maven-plugin/pmd.html":{"name":"PMD","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/pmd.html","name":"PMD"}]},"/hibernate-maven-plugin/plugin-info.html":{"name":"Plugin Documentation","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"},{"uri":"/hibernate-maven-plugin/plugin-info.html","name":"Plugin Documentation"}]},"/hibernate-maven-plugin/project-reports.html":{"name":"Project Reports","childs":{"/hibernate-maven-plugin/testapidocs/index.html":"Test JavaDocs","/hibernate-maven-plugin/apidocs/index.html":"JavaDocs","/hibernate-maven-plugin/xref/index.html":"Source Xref","/hibernate-maven-plugin/xref-test/index.html":"Test Source Xref","/hibernate-maven-plugin/cpd.html":"CPD","/hibernate-maven-plugin/pmd.html":"PMD","/hibernate-maven-plugin/plugin-info.html":"Plugin Documentation"},"crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/project-reports.html","name":"Project Reports"}]},"/hibernate-maven-plugin/configuration.html":{"name":"Configuration Examples","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/configuration.html","name":"Configuration Examples"}]},"/hibernate-maven-plugin/create-mojo.html":{"name":"Goal: CREATE","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/create-mojo.html","name":"Goal: CREATE"}]},"/hibernate-maven-plugin/drop-mojo.html":{"name":"Goal: DROP","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/drop-mojo.html","name":"Goal: DROP"}]},"/hibernate-maven-plugin/debugging.html":{"name":"Enable Debugging-Output","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/debugging.html","name":"Enable Debugging-Output"}]},"/hibernate-maven-plugin/skip.html":{"name":"Skipping Execution","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/skip.html","name":"Skipping Execution"}]},"/hibernate-maven-plugin/force.html":{"name":"Force Exceution","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/force.html","name":"Force Exceution"}]},"/hibernate-maven-plugin/pitfalls.html":{"name":"Known Pitfalls (FAQ)","crumbs":[{"uri":"/projects.html","name":"Projects"},{"uri":"/hibernate-maven-plugin/index.html","name":"Hibernate Maven Plugin"},{"uri":"/hibernate-maven-plugin/pitfalls.html","name":"Known Pitfalls (FAQ)"}]}}}'
407 <title>Hibernate Maven Plugin — Configuration Examples</title>
408 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
409 <link rel="canonical" href="/hibernate-maven-plugin/configuration.html"/>
415 <li><a href="index.html">Hibernate Maven Plugin</a></li><li><a href="configuration.html">Configuration Examples</a></li> </ol>
418 <article class="main" layout:fragment="maincontent">
423 <h1>Configuration Examples</h1>
425 <div class="section">
426 <h2><a name="Configuration_Through_A_Configuration-File"></a>Configuration Through A Configuration-File</h2>
429 The most simple way to configure the plugin is, to put all the
430 hibernate-configuration in a <b>hibernate.properties</b>- or
431 a <b>hibernate.cfg.xml</b>-file on your classpath or in the
432 <b>persistence.xml</b>-file of your JPA-configuration, just
433 like you would do, if you are not using the
434 <tt>hibernate-maven-plugin</tt>.
438 Doing so, the only additionally configuration needed, to activat the plugin
439 is the following entry in the <tt>plugins</tt>-section of your <tt>pom.xml</tt>:
443 <pre class="prettyprint linenums lang-html">
445 <groupId>de.juplo</groupId>
446 <artifactId>hibernate-maven-plugin</artifactId>
447 <version>2.1.0</version>
451 <goal>create</goal>
455 </plugin></pre></div>
458 This would create the configured database.
459 If you want it to be droped beforehand, you have to add the goal
464 <pre class="prettyprint linenums lang-html">
466 <groupId>de.juplo</groupId>
467 <artifactId>hibernate-maven-plugin</artifactId>
468 <version>2.1.0</version>
472 <goal>drop</goal>
473 <goal>create</goal>
477 </plugin></pre></div>
480 A correspondin goal for the command <tt>update</tt> is missing in this
481 version, but we are planning to implement it in near feature.
485 In order to let this configuration work, your configuration file must
486 contain a complete valid configuration for the database, that you want
488 A simple example <tt>hibernate.properties</tt>-file may look like this:
492 <pre class="prettyprint linenums lang-properties">
493 hibernate.dialect=org.hibernate.dialect.H2Dialect
494 hibernate.connection.url=jdbc:h2:file:./target/db
495 hibernate.connection.driver_class=org.h2.Driver
496 hibernate.connection.username=sa
497 hibernate.connection.password=</pre></div>
500 But be aware, that using this configuration-approach the database-url,
501 that is build in the application is the same that is used while testing,
502 where the database is droped and recreated by the plugin.
505 you should never fire up this configuration on your production
506 system, or your database might be erased!
511 A better approach is, to specify a different url for testing like in the
516 <pre class="prettyprint linenums lang-html">
518 <groupId>de.juplo</groupId>
519 <artifactId>hibernate-maven-plugin</artifactId>
520 <version>2.1.0</version>
524 <goal>drop</goal>
525 <goal>create</goal>
529 <configuration>
530 <url><![CDATA[jdbc:mysql://localhost/test-db]]></url>
531 </configuration>
532 </plugin></pre></div>
535 Configuration properties, that are set in the <tt>configuration</tt>-section
536 of the plugin-configuration cannnot be overwritten elsewere (for details
537 see <a href="#precedence">Configuration-Method-Precedence</a>).
538 You never can overwrite them by accident when specifying a property on
539 the commandline or in your <tt>settings.xml</tt>.
542 <div class="section">
543 <h2><a name="Configuration_through_maven-properties"></a>Configuration through maven-properties</h2>
546 Alternatively, it is possible, to configure the plugin via maven-properties.
547 Each relevant configuration-option has a corresponding maven-property
548 (for a full list see the <a href="./create-mojo.html">Documentation of the goal create</a>).
549 These are named after the
550 <a class="externalLink" href="http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#configuration-hibernatejdbc">Hibernate JDBC Properties</a>:
555 <li><tt>hibernate.connection.driver_class</tt></li>
557 <li><tt>hibernate.dialect</tt></li>
559 <li><tt>hibernate.connection.url</tt></li>
561 <li><tt>hibernate.connection.username</tt></li>
563 <li><tt>hibernate.connection.password</tt></li>
567 So, instead of writing the hibernate-configuration in the properties-file,
568 like above, you could put it in the <tt>properties</tt>-section of your
573 Thogether with the plugin-definition from above, the following would
574 be a complete configuration (again, the database-url was overwritten in
575 the plugin-configuration, to be sure to have a separate database for
580 <pre class="prettyprint linenums lang-html">
582 <hibernate.connection.driver_class>org.hsqldb.jdbcDriver</hibernate.connection.driver_class>
583 <hibernate.dialect>org.hibernate.dialect.HSQLDialect</hibernate.dialect>
584 <hibernate.connection.url><![CDATA[jdbc:hsqldb:res:org.my.path.production_db]]></hibernate.connection.url>
585 <hibernate.connection.username>sa</hibernate.connection.username>
586 <hibernate.connection.password></hibernate.connection.password>
596 <groupId>de.juplo</groupId>
597 <artifactId>hibernate-maven-plugin</artifactId>
598 <version>2.1.0</version>
602 <goal>drop</goal>
603 <goal>create</goal>
607 <configuration>
608 <url><![CDATA[jdbc:hsqldb:target/db/testdb;shutdown=true]]></url>
609 </configuration>
612 <plugins></pre></div>
615 This way, you can reuse the same properties to provide a
616 default-configurationthe, that is build into your application, and
617 overwrite the database-url, that is used during testing to prevent
618 accidential drops of your production database.
621 <div class="section">
622 <h2><a name="Configuration_through_the_plugin-configuration"></a>Configuration through the plugin-configuration</h2>
625 A third way for configuring the plugin is the plugin-configuration.
626 The relevant configuration-parameters are:
631 <li><tt>driver</tt></li>
633 <li><tt>dialect</tt></li>
635 <li><tt>url</tt></li>
637 <li><tt>username</tt></li>
639 <li><tt>password</tt></li>
643 The equivalent of the configuration from the last section would look
648 <pre class="prettyprint linenums lang-html">
650 <groupId>de.juplo</groupId>
651 <artifactId>hibernate-maven-plugin</artifactId>
652 <version>2.1.0</version>
656 <goal>drop</goal>
657 <goal>create</goal>
661 <configuration>
662 <driver>org.hsqldb.jdbcDriver</driver>
663 <dialect>org.hibernate.dialect.HSQLDialect</dialect>
664 <url><![CDATA[jdbc:hsqldb:target/db/fotos;shutdown=true]]></url>
665 <username>sa</username>
666 <password></password>
667 </configuration>
668 </plugin></pre></div>
671 The parameter <b>hibernateProperties</b> (name of the hibernate-properties-file
672 to use, defaults to <b>hibernate.properties</b>) can only be configured through
677 For more explanations, see the
678 <a href="./create-mojo.html">Documentation of the goal create</a>.
681 <div class="section" id="precedence">
682 <h2 id="precedence">Configuration-Method-Precedence</h2>
685 The configuration is gathered in a fix order:
688 <ol style="list-style-type: decimal">
690 <li><tt>hibernate.properties</tt></li>
692 <li><tt>hibernate.cfg.xml</tt></li>
694 <li><tt>persistence.xml</tt></li>
696 <li>maven-properties</li>
698 <li>plugin-configuration</li>
702 If you are in doubt about where a configuration-value comes from, run
703 maven with the <a href="./debugging.html">debug-output</a> enabled: <tt>mvn -X hibernate:create</tt>
704 and be aware, that maven-properties can be overwitten on the command-line,
705 in your <tt>~/.m2/settings.xml</tt> and in a profile.
709 The plugin-configuration comes last and overwrites everything else.
710 That way, you can be sure, that a configuration-value, that is
711 specified in the plugin-configuration will never be overwritten by any
712 other configuration-method.
716 If you need to overwrite plugin-configuration-values with
717 maven-properties, you can use maven-properties in the plugin-configuration:
721 <pre class="prettyprint linenums lang-html">
723 <groupId>de.juplo</groupId>
724 <artifactId>hibernate-maven-plugin</artifactId>
725 <version>2.1.0</version>
729 <goal>drop</goal>
730 <goal>create</goal>
734 <configuration>
735 <password>${my-password-property}</password>
736 </configuration>
737 </plugin></pre></div>
745 <li><a href="integration.html">CI Management</a></li><li><a href="dependencies.html">Dependencies</a></li><li><a href="dependency-info.html">Dependency Information</a></li><li><a href="distribution-management.html">Distribution Management</a></li><li><a href="index.html">Overview</a></li><li><a href="license.html">Licenses</a></li><li><a href="plugin-management.html">Plugin Management</a></li><li><a href="plugins.html">Plugins</a></li><li><a href="team-list.html">Team</a></li><li><a href="source-repository.html">Source Code Management</a></li><li><a href="project-summary.html">Summary</a></li><li><a href="project-info.html">Project Information</a></li><li><a href="testapidocs/index.html">Test JavaDocs</a></li><li><a href="apidocs/index.html">JavaDocs</a></li><li><a href="xref/index.html">Source Xref</a></li><li><a href="xref-test/index.html">Test Source Xref</a></li><li><a href="cpd.html">CPD</a></li><li><a href="pmd.html">PMD</a></li><li><a href="plugin-info.html">Plugin Documentation</a></li><li><a href="project-reports.html">Project Reports</a></li><li><a href="configuration.html">Configuration Examples</a></li><li><a href="create-mojo.html">Goal: CREATE</a></li><li><a href="drop-mojo.html">Goal: DROP</a></li><li><a href="debugging.html">Enable Debugging-Output</a></li><li><a href="skip.html">Skipping Execution</a></li><li><a href="force.html">Force Exceution</a></li><li><a href="pitfalls.html">Known Pitfalls (FAQ)</a></li> </ul>