Hi.
I have an entity structure as follows:
E1
List<E2> e2s; //is lazy embeddable
E2
E3 e3; // is lazy one-to-one
E3
So I’m able to “pre-fetch” e2s by:
SELECT e1
FROM E1 e1
JOIN FETCH e1.e2s AS e2Alias
But I also need to “prefetch” the e2.e3. If I try to do something like:
SELECT e1
FROM E1 e1
JOIN FETCH e1.e2s AS e2Alias
JOIN FETCH e2Alias.e3
I’m getting:
query specified join fetching, but the owner of the fetched association was not present in the select list
As I understand JOIN FETCH
is for collections.
In case of
SELECT e1
FROM E1 e1
JOIN FETCH e1.e2s AS e2Alias
JOIN e2Alias.e3
It generates correct join part but doesn’t use result in the SELECT
part in the generated SQL
What todo in case of one-to-one?