Chapter 5. The Java Persistence Query Language
EJB 3 provides the Java Persistence Query Language (JPQL). In this chapter we will cover:
Projections
GROUP BY and HAVING clauses
Joins
Subqueries
Dynamic Queries
Functions
Queries with parameters
Handling Date and Time
Bulk update and delete operations
Native SQL
Introduction
A rather limited query language, EJB QL, was provided in EJB 2.0 and 2.1. JPQL enhances EJB QL by providing the following features: JOINs, GROUP BY, HAVING, projection, subqueries, dynamic queries, bulk update and delete. We shall see examples of all these features in this chapter.
JPQL is similar to the SQL language for querying relational databases. However, JPQL queries are expressed in Java objects rather than tables and columns. As ...
Get EJB 3 Developer Guide 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.