如何从实体生成元模型?

时间:2014-01-30 09:57:50

标签: java spring hibernate maven criteria

我试图用hibernate工具做这个,还有像这样的maven:

<dependency>
  <groupId>br.com.ingenieux.maven.annomojo</groupId>
  <artifactId>org.jfrog.maven.maven-plugin-anno</artifactId>
  <version>1.4.1</version>
</dependency>

<plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <executions>
        <execution>
            <id>process</id>
            <goals>
                <goal>process</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
                <!-- source output directory -->
                <outputDirectory>target/metamodel</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.3</version>
    <executions>
        <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
                <goal>add-source</goal>
            </goals>
            <configuration>
                <sources>
                    <source>target/metamodel</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

我在这个论坛上看过帖子,但他们没有帮助。 有人可以帮助我吗?我很困惑(我需要元模型来创建标准)

P.S。此链接未说明如何制作:http://hibernate.org/orm/tooling/。我读了很多关于它的信息,但无法弄清楚......

1 个答案:

答案 0 :(得分:0)

maven-processor-plugin需要依赖,如下所示:

<plugin>
    <groupId>org.bsc.maven</groupId>
    <artifactId>maven-processor-plugin</artifactId>
    <executions>
        ...
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
            <version>1.2.0.Final</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</plugin>