Jakarta Persistence Query Language

1

The Jakarta Persistence Query Language (JPQL; formerly Java Persistence Query Language) is a platform-independent object-oriented query language defined as part of the Jakarta Persistence (JPA; formerly Java Persistence API) specification. JPQL is used to make queries against entities stored in a relational database. It is heavily inspired by SQL, and its queries resemble SQL queries in syntax, but operate against JPA entity objects rather than directly with database tables. In addition to retrieving objects ( queries), JPQL supports set based and queries.

Examples

Example JPA Classes, getters and setters omitted for simplicity. Then a simple query to retrieve the list of all authors, ordered alphabetically, would be: To retrieve the list of authors that have ever been published by XYZ Press: JPQL supports named parameters, which begin with the colon. We could write a function returning a list of authors with the given last name as follows:

Hibernate Query Language

JPQL is based on the Hibernate Query Language (HQL), an earlier non-standard query language included in the Hibernate object-relational mapping library. Hibernate and the HQL were created before the JPA specification. As of Hibernate 3 JPQL is a subset of HQL.

Citations

This article is derived from Wikipedia and licensed under CC BY-SA 4.0. View the original article.

Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc.
Bliptext is not affiliated with or endorsed by Wikipedia or the Wikimedia Foundation.

View original