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 IdentifierIds 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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With