来自实体的生成表

时间:2014-04-07 08:01:02

标签: java maven jpa eclipselink

我是maven和jpa的新人。我正在使用maven开发模块化应用程序。我开始从模型模块实现它,我有一些带注释的实体bean。现在我的麻烦是我想从这个对象创建表。这是否可以使用maven插件?

我还没有用户界面,我无法部署任何东西

这是我的pom.xml:

    <project>
    <modelVersion>4.0.0</modelVersion>
        <parent>
            <groupId>it.mycompany</groupId>
            <artifactId>myparent</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </parent>
        <artifactId>model</artifactId>

  <dependencies>

        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.jpa</artifactId>
            <version>2.5.1</version>
        </dependency>


        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.1</version>
        </dependency>
    </dependencies>

</project>

如何生成它们?

1 个答案:

答案 0 :(得分:0)

如果你在发展环境中使用eclipse:

这是我的主张:

1-你在eclipse中创建一个JPA项目。 2-您配置connexion的参数。(右键单击项目 - &gt; JPA工具 - &gt;来自entites的Genarate表)并继续执行步骤。

有关详细信息,您可以使用eclipse的官方文档(JPA工具):http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.jpt.doc.user%2Ftasks021.htm