2.10.2.3.5. JPQL Joins
An inner join may be implicitly specified by the use of a cartesian product in the FROM clause and a join condition in the WHERE clause.
In the absence of a join condition, this reduces to the cartesian product.
The main use case for this generalized style of join is when a join condition does not involve a foreign key relationship that is mapped to an entity relationship, for example:
SELECT c FROM Customer c, Employee e WHERE c.hatsize = e.shoesize
In general, use of this style of inner join (also referred to as theta-join) is less typical than explicitly defined joins over relationships.
The syntax for explicit join operations is as follows:
-
join ::= join_spec join_association_path_expression [AS] identification_variable
-
fetch_join ::= join_spec FETCH join_association_path_expression
-
join_association_path_expression ::= join_collection_valued_path_expression | join_single_valued_path_expression
-
join_collection_valued_path_expression::= identification_variable.{single_valued_embeddable_object_field.}*collection_valued_field
-
join_single_valued_path_expression::= identification_variable.{single_valued_embeddable_object_field.}*single_valued_object_field
-
join_spec ::= [ LEFT [OUTER] | INNER ] JOIN
The inner and outer join operation types described in JPQL Inner Joins (Relationship Joins) and JPQL Outer Joins are supported.