Configuration Examples * Configuration through a hibernate.properties-File The most simple way to configure the plugin is, to put all the hibernate-configuration in a <>-file on your classpath. Put the file in the <<>>-folder. Maven will put it in the <<>>-folder of your webapp, where it will be picked up by this plugin as well as by Hibernate 4. Doing so, the only additionally configuration needed, to activat the plugin is the following entry in the <<>>-section of your <<>>: --------------- de.juplo hibernate4-maven-plugin ${project.version} export --------------- But be aware, that in this case the database-url, that is build in the application is the same that is used while testing, where the database is droped and recreated by the plugin. <<>> Hence, you should specify a different url for testing like in the following snippet: --------------- de.juplo hibernate4-maven-plugin ${project.version} export --------------- Configuration properties, that are set in the <<>>-section of the plugin-configuration cannnot be overwritten elsewere (for details see {{Configuration-Method-Precedence}}). You never can overwrite them by accident when specifying a property on the commandline or in your <<>>. * Configuration through maven-properties Alternatively, it is possible, to configure the plugin via maven-properties. Each relevant configuration-option has a corresponding maven-property (for a full list see the {{{./export-mojo.html} Documentation of the export-Mojo}}). These are named after the {{{http://docs.jboss.org/hibernate/orm/4.1/manual/en-US/html_single/#configuration-hibernatejdbc} Hibernate JDBC Properties}}: * <<>> * <<>> * <<>> * <<>> * <<>> So, instead of writing the hibernate-configuration in the properties-file, like above, you could put it in the <<>>-section of your <<>>. Thogether with the plugin-definition from above, the following would be a complete configuration (again, the database-url was overwritten in the plugin-configuration, to be sure to have a separate database for testing): --------------- org.hsqldb.jdbcDriver org.hibernate.dialect.HSQLDialect sa ... ... de.juplo hibernate4-maven-plugin ${project.version} export --------------- * Configuration through the plugin-configuration A third way for configuring the plugin is the plugin-configuration. The relevant configuration-parameters are: * <<>> * <<>> * <<>> * <<>> * <<>> The equivalent of the configuration from the last section would look like this: --------------- de.juplo hibernate4-maven-plugin ${project.version} export org.hsqldb.jdbcDriver org.hibernate.dialect.HSQLDialect sa --------------- There are some seldom used parameters, that can only be configured throug this method: * <> the delimiter used in the generated sql-script * <> wether the generated sql-script is formatted, or not * <> name of the hibernate-properties-file * <> name of the generated sql-script * <> create database or generate sql-script or both * <> create or drop the database or do both or nothing (just validate the annotation-configuration) For explanations, see the {{{./export-mojo.html} Documentation of the export-Mojo}}. {Configuration-Method-Precedence} The configuration is gathered in a fix order: [[1]] <<>> [[2]] maven-properties [[3]] plugin-configuration If you are in doubt about where a configuration-value comes from, run maven with the {{{./debugging.html}debug-output}} enabled: <<>> and be aware, that maven-properties can be overwitten on the command-line, in your <<<~/.m2/settings.xml>>> and in a profile. The plugin-configuration comes last and overwrites everything else. That way, you can be sure, that a configuration-value, that is specified in the plugin-configuration will never be overwritten by any other configuration-method. If you realy need to overwrite plugin-configuration-values with maven-properties, you can use maven-properties in the plugin-configuration: ---------------- de.juplo hibernate4-maven-plugin ${project.version} export ${my-password-property} ----------------