I do not think that I will ever fully understand to join them.
I have a query where I am trying to "inflate" links to two levels.
That is, my A has an optional Collection of B s, and each B has either 0 or 1 C It is known that the size of collection B small (10β20 peaks). I would like to pre-select this chart.
A B Marked as FetchType.LAZY and is optional. B relation to C also optional and FetchType.LAZY .
I was hoping I could do:
SELECT a FROM A a LEFT JOIN FETCH a.bs // look, no alias; JPQL forbids it LEFT JOIN a.bs b // "repeated" join necessary since you can't alias fetch joins LEFT JOIN FETCH bc // this doesn't seem to do anything WHERE a.id = :id
When I run this, I see that the set A B really selected (I see the LEFT JOIN in SQL referencing the table that B mapped to).
However, I do not see such evidence that table C is being retrieved.
How can I preselect all C and all B and all C that are βreachableβ from given A ? I see no way to do this.
Laird nelson
source share