Compilation error due to "cannot find the name of the annotation method () in type javax.persistence.Table"

My project does not compile and gives the following errors:

Information : D: \ Projects \ GRE \ COM \ site \ kernel \ domain \ Employee.class: warning: cannot find the annotation method 'schema ()' in type 'javax.persistence.Table': class file for javax. persistence.Table not found.
Info: D: \ projects \ gre \ com \ site \ core \ domain \ Employee.class: warning: cannot find the annotation method 'name ()' in type 'javax.persistence.Table': class file for javax.persistence. Table not found.
Info: D: \ projects \ gre \ com \ site \ core \ domain \ Employee.class: warning: cannot find the annotation method 'fetch ()' in type 'javax.persistence.ManyToOne': class file for javax.persistence. ManyToOne not found. Information: An exception occurred in the compiler (1.6.0_22). Please write the error to the Java Developer Conncetion (http://java.sun.com/webapps/bugreport) after checking the Error Parameter for duplicates. Include your program and the following diagnostics in your report. Thanks. Info: 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: internal compiler error. Process terminated by exit code 4

I am using IntelliJ Idea 9, properly attached hibernate-jpa-2.0-api-1.0.0.Final.jar
I blocked the cache, deleted / war folders, but still had a compile time error.

+4
source share
2 answers

I also use IntelliJ and hibernate-jpa-2.0-api-1.0.0.Final.jar and javax / persistence / Table.class and javax / persistence / ManyToOne.class, certainly in this JAR.

I can only think that the JAR is not in your classpath. Where did you place this JAR? What do you use to try to compile your code? Are you sure this is on your way to class?

+2
source

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

BTW is trying to use maven as a building tool and forget about resolving dependencies between third-party libraries.

+1
source

Source: https://habr.com/ru/post/1339490/


All Articles