Chapter 4 - JPA Queries (JPQL / Criteria)
The Jakarta Persistence Query Language (JPQL) is an object-oriented version of SQL. Users familiar with SQL should find JPQL easy to learn and use. This chapter explains how to use JPQL and the Jakarta Persistence (JPA) Criteria Query API, which provides an alternative way to build queries in JPA.
The first section describes the JPA API for running dynamic and static (named) queries. It explains how to use the relevant interfaces, annotations, enums, and methods but does not cover the JPQL syntax in detail:
The next two sections cover the Jakarta Persistence Query Language (JPQL). The first section explains the structure of a JPQL query and a criteria query by describing the main clauses: SELECT, FROM, WHERE, GROUP BY, HAVING, and ORDER BY:
The next section explains the expressions used to build JPQL and criteria query clauses:
ObjectDB also supports the Java Data Objects (JDO) Query Language (JDOQL), which is more Java-oriented and is based on Java syntax. JDOQL is not covered in this manual.