【问题标题】:How to output two ddl files at the same time with using maven hbm2ddl plugin如何使用maven hbm2ddl插件同时输出两个ddl文件
【发布时间】:2011-02-24 23:13:11
【问题描述】:

我们的应用需要用到两种不同的数据库,一种是oracle,一种是mysql,我们想用maven插件hbm2ddl生成ddl文件,想同时输出两个ddl文件,我不知道如何在 pom.xml 中设置配置。我尝试使用这个插件两次,但它总是生成一个 ddl 文件。有没有人遇到过这种情况?你能不能给点建议。

【问题讨论】:

    标签: hibernate maven-2 hbm2ddl hibernate3


    【解决方案1】:

    不要使用插件两次,使用同一个插件两次执行

      <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>
    

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 1970-01-01
      • 1970-01-01
      • 2012-04-09
      • 2018-01-19
      • 1970-01-01
      • 2011-09-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多