| title | layout |
|---|---|
Maven Plugin for DDL Generation |
withMenu |
DDL Generator is a Maven plugin to generate DDL file from a Maven project using JPA/Hibernate. It has been created as a (very) partial replacement of the Maven Hibernate3 Plugin which is not working under Hibernate 4.
- Simple generation of DDL file as part of the Maven build processs.
- Support for entities dispatched on multiple PU by embedding MultiConfigAwarePersistenceUnitManager.
- Support for any Hibernate dialect or naming strategy.
The plugin has one goal: generate. It takes the following mandatory parameters:
ddlFile: destination ddl file.dialect: full class name of the dialect to use for the generation.persistenceUnitName: name of the persistence unit.
And the following optional parameters:
defaultSchema: the schema to use if an explicit schema naming is required in the DDL file.namingStrategy: the class name of the naming strategy to use if the default one is not ok.persistenceXmlLocations: a list of persistence unit definition files.useNewGenerator: set totrueis the new hibernate id generator should be used.
The following configuration needs to be inserted in the pom.xml file:
{% highlight xml %} net.ggtools.maven ddlgenerator-maven-plugin 0.1 generate prepare-package ${project.build.directory}/sql/schema.sql org.hibernate.dialect.H2Dialect MultiPU classpath*:/META-INF/persistence.xml classpath*:/META-INF/persistence-*.xml true {% endhighlight %}
The source repository and issue tracking is hosted on GitHub.
- 0.1: First public release.