使用Criteria编译错误JEE 6项目

时间:2016-12-22 18:16:59

标签: jpa eclipselink

我在JDK 1.7u52上运行的Netbeans 8.2中有一个Java EE 6项目,当我在IDE中编译并启动它时运行正常。但是,当我清理并构建项目时,我收到以下错误:

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type ch.djan.lee.compute.entity.SpaceLog_
    at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:407)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981)

注意:我正在研究Criteria和eclipsLink 2.4

1 个答案:

答案 0 :(得分:0)

解决方案是更新你的persistence.xml文件,如下所示:

<persistence-unit name="first_PU">
   <properties>
    <property name="eclipselink.canonicalmodel.subpackage" value="first"/>
   </properties>
</persistence-unit>

<persistence-unit name="second_PU">
   <properties>
      <property name="eclipselink.canonicalmodel.subpackage" value="second"/>
   </properties>
</persistence-unit>

<persistence-unit name="third_PU">
   <properties>
    <property name="eclipselink.canonicalmodel.subpackage" value="third"/>
   </properties>
</persistence-unit>

在部署项目后,您将获得:

ch.djan.lee.compute.entity.SpaceLog.first 
ch.djan.lee.compute.entity.SpaceLog.second 
ch.djan.lee.compute.entity.SpaceLog.third