Is it true that JPA's CriteriaQuery uses JPQL?


#1

Or does firing off JPQL queries use the Criteria API under the hood?

Thanks!


#2

Criteria API is an entity query builder, so the final outcome is the JPQL. It makes lot of sense if you think about it.

JPQL is translated to SQL.

So, the flow goes like this:

  • JPQL -> SQL
  • Criteria API -> JPQL -> SQL