How is JPQL different from SQL?
JPQL operates on classes and objects (entities) in the Java space. SQL operates on tables,
columns, and rows in the database space. Although JPQL and SQL look similar, they oper-
ate in two very different worlds.
The JPQL query parser or processor engine of a persistence provider, as shown in figure
Figure 11.1. Each JPQL query is translated to an SQL query by the JPQL query processor and executed by the
database. The query processor is supplied by the JPA provider, most likely the application server vendor.
JPQL looks so much like SQL that it's easy to forget you're looking at JPQL when you're
reviewing source code. Just remember that although JPQL may look like SQL, you'll need
to be aware of the differences discussed in this chapter to effectively use and troubleshoot
JPQL in your programs.
All this talk about JPQL queries has piqued your interest, hasn't it? What do you say to
continuing this line of thinking by going over the types of statements JPQL supports? Then
we'll discuss different elements of a JPQL statement, such as FROM and SELECT clauses,
conditional statements, subqueries, and various types of functions. Finally, we'll take a
look at update and delete statements.
11.1.1. Statement types
form selects, updates, and deletes in your queries.