I have a jpql query to eagerly fetch multi level associations as follows
select distinct s from Singer s
left join fetch s.singerIdentifiers si //singerIdentifiers is collection in Singer object
left join fetch si.identifier i
left join fetch i.identifierReportedAreas ira
left join fetch irc.reportedArea ra
left join fetch rc.reportingSystem rs
where s.id in (?);
This generates multiples queries, though I am getting all the required information in the first select itself. All extra queries are for querying SingerIdentifier table data for distinct Identi开发者_运维知识库fierIds from the first query.
Any help in this regard is highly appreciated.
Maybe a typo?
left join fetch i.identifierReportedAreas -->ira<--
left join fetch -->irc<---.reportedArea ra
精彩评论