【发布时间】:2011-02-24 23:13:11
【问题描述】:
我们的应用需要用到两种不同的数据库,一种是oracle,一种是mysql,我们想用maven插件hbm2ddl生成ddl文件,想同时输出两个ddl文件,我不知道如何在 pom.xml 中设置配置。我尝试使用这个插件两次,但它总是生成一个 ddl 文件。有没有人遇到过这种情况?你能不能给点建议。
【问题讨论】:
标签: hibernate maven-2 hbm2ddl hibernate3
我们的应用需要用到两种不同的数据库,一种是oracle,一种是mysql,我们想用maven插件hbm2ddl生成ddl文件,想同时输出两个ddl文件,我不知道如何在 pom.xml 中设置配置。我尝试使用这个插件两次,但它总是生成一个 ddl 文件。有没有人遇到过这种情况?你能不能给点建议。
【问题讨论】:
标签: hibernate maven-2 hbm2ddl hibernate3
不要使用插件两次,使用同一个插件两次执行
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<!--common configuration here -->
</configuration>
<executions>
<execution>
<id>db1</id>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<!-- db-specific configuration here -->
</configuration>
</execution>
<execution>
<id>db2</id>
<goals>
<goal>hbm2ddl</goal>
</goals>
<configuration>
<!-- db-specific configuration for second db here -->
</configuration>
</execution>
</executions>
</plugin>
【讨论】: