2011-08-19 31 views
3

我能在我的pom.xml具有这种基于Java的JPA-entites的运行Hibernate的jpamodelgen:如何在斯卡拉实体运行Hibernate的JPAMetaModelEntityProcessor静态模型生成

<dependency> 
    <groupId>org.hibernate</groupId> 
    <artifactId>hibernate-jpamodelgen</artifactId> 
    <version>1.1.1.Final</version> 
</dependency> 

但失败的书面实体当然在斯卡拉。我一直在努力,“手动”使用有我的pom.xml这个样子行家处理器的插件生成的元模型:

<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> 
       <processors> 
        <!-- list of processors to use --> 
        <processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor> 
       </processors> 
       <!-- 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> 

但没有任何反应。

任何人都成功地从JPA实体编写的斯卡拉JPA元模型?

谢谢。

回答

1

不要认为这是可能的,因为元模型生成器在javac中作为可插入注释处理器(http://jcp.org/en/jsr/detail?id=269)运行,即在Java源中。

然而,Javac不会理解你的Scala源代码和Scalac(据我所知)并不支持JSR 269接口。