【问题标题】:how to generate meta model from entity?如何从实体生成元模型?
【发布时间】:2014-02-22 13:23:47
【问题描述】:

我试图用休眠工具来做到这一点,还有像这样的 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>

我阅读了这个论坛上的帖子,但它们没有帮助。 有人可以帮我实现吗?我很困惑(我需要元模型来创建标准)

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

【问题讨论】:

    标签: java spring hibernate maven criteria


    【解决方案1】:

    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>
    

    【讨论】:

    • 虽然您可能希望将版本更改为“4.3.1.Final”
    • 这是一个废话,我按照你的建议做了。已经通过eclipse以另一种方式解决了它。干杯
    猜你喜欢
    • 2011-03-03
    • 1970-01-01
    • 2012-03-25
    • 2014-07-23
    • 1970-01-01
    • 1970-01-01
    • 2020-07-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多