Hibernate Criteria Query Language

There is an alternative way provided by Hibernate to manipulate objects and in turn the data available in an RDBMS table. A Java programmer might feel it is easier to use Hibernate Criteria Query Language (HCQL) as it supports methods to add criteria on a query.

The Criteria interface

We can build a criteria object using the Criteria interface, where we can apply logical conditions and filtration rules. The Session interface of Hibernate provides the createCriteria() method to create a Criteria object that returns an instance of a persistence object's class when your application executes a criteria query.

The following is a list of commonly used methods from the Criteria interface:

Method

Description

public Criteria ...

Get Spring: Developing Java Applications for the Enterprise now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.