Javatpoint Logo
Javatpoint Logo

JPA Criteria Having clause

The HAVING clause is used with GROUP BY clause to filter the data in a table. In Criteria API, the having() method of Abstract interface is used to set the conditions on the grouped data.

Criteria HAVING Example

Here, we will perform GROUP BY with HAVING operations on student table. Let us assume the table contains the following records: -

JPA Criteria Having clause

Now, follow the below steps to perform operations: -

  • Create an entity class names as under com.javatpoint.jpa package. This class contains three attributes s_id, s_name and s_age with all the required annotations.

  • Now, map the entity class and other databases confiuguration in Persistence.xml file.


  • Once, we created the basic entity class and mapped the configuration into persistence.xml file, we can perform the different types of HAVING operation. Here, we are grouping the number of student having age either equal or greater than 24.


JPA JPQL Having clause

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA