JPQL
With the Java Persistence Query Language the persistence objects graph can be queried, in a similar way to querying a database by using SQL, and it looks just like that.
Values Placeholders
Queries can contain variables, which are swapped by actual values when executing the query.
In this example there is a variable named id:
Executing queries
A query can be executed with a javax.persistence.EntityManager.
Integration
JPQL can be used by any JPA implementation, replacing other query languages.
Differences Between Implementations
Note that some implementations may give problems with certain operations. Changing from one JPA provider to another, or switching from a JDBC to another may cause unexpected issues.
For example this query works with Eclipselink:
But will fail with Hibernate, which requires this one:
More Information
Last updated
Was this helpful?