Eclipse how to use the JPA static metamodel classes while writing criteria queries in Hibernate

When you use Maven you have to add in your POM following dependency:

<dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-jpamodelgen</artifactId> 
     <version>5.3.7.Final</version> 
</dependency>

Now you have to add folder target\generated-sources\annotations to your classpath as by default, the classes will be generated in this folder only. You go in

Project Build Path -> Configure Build Path -> Java Build Path -> Source and there make add folder

Now you can use the metamodel entity classes as User_ made from entity User

Leave a comment