Wednesday, June 22, 2011

generate database DDL

Roo automatically generates the database but does not provide a DDL. To generate a DDL add the following text to the pom:
<!-- Generate DDL -->
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>hibernate3-maven-plugin</artifactId>
  <version>2.2</version>
  <executions>
<execution>
  <phase>process-classes</phase>
  <goals>
    <goal>hbm2ddl</goal>
  </goals>
</execution>
  </executions>
  <configuration>
<components>
  <component>
    <name>hbm2ddl</name>
    <implementation>jpaconfiguration</implementation>
  </component>
</components>
<componentProperties>
  <propertyfile>src/main/resources/database.properties</propertyfile>
  <persistenceunit>persistenceUnit</persistenceunit>
  <outputfilename>schema.ddl</outputfilename>
  <drop>false</drop>
  <create>true</create>
  <export>false</export>
  <format>true</format>
</componentProperties>
  </configuration>
</plugin>

No comments: