10.4.5. About the WITH Clause
HQL defines a
WITH
clause to qualify the join conditions. This is specific to HQL; JPQL does not define this feature.
Example 10.4. with-clause Join Example
select distinct c from Customer c left join c.orders o with o.value > 5000.00
The important distinction is that in the generated SQL the conditions of the
with clause
are made part of the on clause
in the generated SQL as opposed to the other queries in this section where the HQL/JPQL conditions are made part of the where clause
in the generated SQL. The distinction in this specific example is probably not that significant. The with clause
is sometimes necessary in more complicated queries.
Explicit joins may reference association or component/embedded attributes. In the case of component/embedded attributes, the join is simply logical and does not correlate to a physical (SQL) join.