JPA hibernate leaves the connection to obtain multiple queries

I have a jpql query that eagerly obtains multi-level associations, as shown below

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 multiple queries, but I get all the necessary information in the first selection All additional queries are used to query the singeridentifier table data of different identifiers from the first query

Thank you very much for any help in this regard

Solution

Maybe it's a typo?

left join fetch i.identifierReportedAreas -->ira<--
  left join fetch -->irc<---.reportedArea ra
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>