Two database tables have a foreign key relationship.
They are mapped to two entities A and B by JPA, but the join columns are manually removed from the entities, so in JPA world classes A and B are not related and you cannot navigate from one to the other through a field/property.
Using the JPA Criteria API, is it possible to create a query which joins the two tables?
All examples I found on internet uses the join column to achieve the goal, but, as stated above, it was removed from the code because most time I'm not interested in the relationship between A and B and I'm afraid about possible overhead.
CROSS JOIN
) between the entities. With theWHERE
condition, this behaves the same as anINNER JOIN
(including same performance as noted here). – Clerkly