This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
Incorrect hibernate version or maven ignore and didn't download hibernate jar file.
posted 4 years ago
Hi, I have an EAR project, consist of EJB and WAR modules.
When I compiled my ejb module, it could not find a method "getCriteriaBuilder()". Full log is shown as below:
Here is the pom.xml file for the ejb module:
Here is the offending code:
I also found that the command "mvn clean install" under my ejb module didn't actually download hibernate jar file. Is there any problem in my pom.xml file?
And I also want to know what version of hibernate support the method "getCriteriaBuilder()".
I double-checked Maven Central and the specific hibernate JAR file your POM references is there. Check your local repository, possibly deleting the ./org/hibernate/hibernate-entitymanager directory; that should force Maven to attempt to download the JAR again (at times I find that a failed download seems to prevent future downloads)
Regarding the getCriteriaBuilder() method, you are calling that on javax.persistence.EntityManager, which is not part of hibernate-entitymanager. Instead, it is part of javax.persistence:persistence-api:1.0, and javax.persistence.EntityManager does not have the getCriteriaBuilder() method