由于“无法在javax.persistence.Table类型中找到注释方法名称()”而编译错误“

时间:2022-11-30 09:43:55

My project is not compiling, and giving these errors:

我的项目没有编译,并给出了这些错误:

Information: D:\projects\gre\com\site\core\domain\Employee.class: warning: Cannot find annotation method 'schema()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found.
Information: D:\projects\gre\com\site\core\domain\Employee.class: warning: Cannot find annotation method 'name()' in type 'javax.persistence.Table': class file for javax.persistence.Table not found.
Information: D:\projects\gre\com\site\core\domain\Employee.class: warning: Cannot find annotation method 'fetch()' in type 'javax.persistence.ManyToOne': class file for javax.persistence.ManyToOne not found.
Information: An Exception has occurred in the compiler(1.6.0_22).Please file a bug at the Java Developer Conncetion(http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
Information: com.sun.tools.javac.code.Symbol$CompilationFailure:class for javax.persistence.FetchType not found
Information: Compilation completed with 1 error and 0 warnings
Information: 1 error
Error: compiler internal error. Process terminated with exit code 4

信息:D:\ projects \ gre \ com \ site \ core \ domain \ Employee.class:warning:找不到类型'javax.persistence.Table'中的注释方法'schema()':javax.persistence.Table的类文件未找到。信息:D:\ projects \ gre \ com \ site \ core \ domain \ Employee.class:warning:找不到类型'javax.persistence.Table'中的注释方法'name()':javax.persistence.Table的类文件未找到。信息:D:\ projects \ gre \ com \ site \ core \ domain \ Employee.class:warning:找不到类型'javax.persistence.ManyToOne'中的注释方法'fetch()':javax.persistence.ManyToOne的类文件未找到。信息:编译器(1.6.0_22)中发生异常。请在检查Bug Parade中的重复项后,在Java Developer Conncetion(http://java.sun.com/webapps/bugreport)上提交错误。在报告中包含您的计划和以下诊断。谢谢。信息:com.sun.tools.javac.code.Symbol $ CompilationFailure:找不到javax.persistence.FetchType的类信息:编译完成时出现1错误和0警告信息:1错误错误:编译器内部错误。进程以退出代码4终止

I'm using IntelliJ Idea 9, properly attached hibernate-jpa-2.0-api-1.0.0.Final.jar
I've invalidated the cache, deleted out/war folders but still having an error at the compile time.

我正在使用IntelliJ Idea 9,正确连接hibernate-jpa-2.0-api-1.0.0.Final.jar我已经使缓存无效,删除了/ war文件夹但在编译时仍然出错。

2 个解决方案

#1


2  

I use IntelliJ as well and hibernate-jpa-2.0-api-1.0.0.Final.jar and javax/persistence/Table.class and javax/persistence/ManyToOne.class are definitely in this JAR.

我也使用IntelliJ和hibernate-jpa-2.0-api-1.0.0.Final.jar和javax / persistence / Table.class和javax / persistence / ManyToOne.class肯定在这个JAR中。

I can only think that the JAR is not in your classpath. Where have you placed this JAR? What are you using to try compile your code? Are you certain it is in your classpath?

我只能认为JAR不在你的类路径中。你在哪里放置这个JAR?您正在使用什么来编译代码?你确定它在你的类路径中吗?

#2


1  

Unfortunately I do not have my dev. environment here but as far as I remember hibernate jar does not necessarily contain the JPA stuff, so you have to add the persistence.jar to your classpath.

不幸的是我没有我的开发。环境在这里,但据我记得hibernate jar不一定包含JPA的东西,所以你必须将persistence.jar添加到你的类路径。

BTW try to use maven as a build tool and forget about resolving dependencies between third party libraries.

BTW尝试使用maven作为构建工具,忘记解决第三方库之间的依赖关系。

#1


2  

I use IntelliJ as well and hibernate-jpa-2.0-api-1.0.0.Final.jar and javax/persistence/Table.class and javax/persistence/ManyToOne.class are definitely in this JAR.

我也使用IntelliJ和hibernate-jpa-2.0-api-1.0.0.Final.jar和javax / persistence / Table.class和javax / persistence / ManyToOne.class肯定在这个JAR中。

I can only think that the JAR is not in your classpath. Where have you placed this JAR? What are you using to try compile your code? Are you certain it is in your classpath?

我只能认为JAR不在你的类路径中。你在哪里放置这个JAR?您正在使用什么来编译代码?你确定它在你的类路径中吗?

#2


1  

Unfortunately I do not have my dev. environment here but as far as I remember hibernate jar does not necessarily contain the JPA stuff, so you have to add the persistence.jar to your classpath.

不幸的是我没有我的开发。环境在这里,但据我记得hibernate jar不一定包含JPA的东西,所以你必须将persistence.jar添加到你的类路径。

BTW try to use maven as a build tool and forget about resolving dependencies between third party libraries.

BTW尝试使用maven作为构建工具,忘记解决第三方库之间的依赖关系。