Compile error because of "cannot find annotation method name() in type javax.persistence.Table"
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 t开发者_Go百科he 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
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.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.
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?
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.
BTW try to use maven as a build tool and forget about resolving dependencies between third party libraries.
精彩评论