如何使用maven hbm2ddl插件同时输出两个ddl文件

发布于 2024-09-03 03:20:03 字数 163 浏览 3 评论 0原文

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

Our application needs to use two different kinds of databases.One is oracle, the other is mysql and we want to use maven plugin hbm2ddl to generate the ddl file, and want to output the two ddl files at the same time, I don't know how to set the configuration in pom.xml. I tried to use this plugin twice, but it always generated one ddl file. Any one encountered such case before ? could u please give some advice.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌生 2024-09-10 03:20:03

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

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

don't use the plugin twice, use the same plugin with two executions

  <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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文