Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Hibernate JPAModelGen生成模型类,但不编译它们_Hibernate_Jpa_Ant_Classpath_Criteria Api - Fatal编程技术网

Hibernate JPAModelGen生成模型类,但不编译它们

Hibernate JPAModelGen生成模型类,但不编译它们,hibernate,jpa,ant,classpath,criteria-api,Hibernate,Jpa,Ant,Classpath,Criteria Api,我们在项目中使用JPA2、Hibernate和CriteriaAPI,我们需要Hibernate的模型生成器来创建元模型类 在我们的Ant构建过程中,我们包含了hibernate-jpamodelgen.jar的注释处理器来为我们生成元模型类 问题是依赖于生成的类的类由于“symbol not found”编译错误而无法编译 [javac] ...\DocumentSpecifications.java:29: cannot find symbol [javac] symbol : class

我们在项目中使用JPA2、Hibernate和CriteriaAPI,我们需要Hibernate的模型生成器来创建元模型类

在我们的Ant构建过程中,我们包含了hibernate-jpamodelgen.jar的注释处理器来为我们生成元模型类

问题是依赖于生成的类的类由于“symbol not found”编译错误而无法编译

[javac] ...\DocumentSpecifications.java:29: cannot find symbol
[javac] symbol  : class Document_
[javac] location: package ...entity
[javac] import ...entity.Document_;
ant脚本如下所示:

<javac srcdir="@{from}" 
  destdir="@{to}"
  source="${compile.option.source-version}"
  target="${compile.option.target-version}"
  debug="${compile.option.debug}"
  debuglevel="${compile.option.debuglevel}"
  includeAntRuntime="false"
  fork="${compile.option.fork}"
  classpathref="path.ivy.libs.compile"
  encoding="${sourcefiles.encoding}">
    <compilerarg line="${compile.option.compilerarg} -s @{metamodel}" />
 </javac>

查看Ant的目标目录可以发现,元模型Java类(.Java)已经在src/metamodel文件夹中成功创建,但是没有类(.class)被编译到build/classes文件夹中

有人知道如何教Ant或Java编译器包含生成的类文件吗?

好的,找到了问题

发生错误时,我正在使用JDK1.6.0_11

使用1.7JDK,它可以正常工作。显然,在使用1.6 JDK时,必须分多个步骤进行编译