You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We noticed that @EntityGraph(attributePaths = ...) is ignored when there is fetch in @Query.
For:
@EntityGraph(attributePaths = {"upgradeRequest.segment"})
@Query("select j from UpgradeJob j" +
" join fetch j.upgradeRequest r" +
// " join fetch j.upgradeRequest.segment" +
" where j.status = :status and r.pnrId = :pnrId")
List<UpgradeJob> findByStatusAndPnrId(UpgradeJobStatus status, Long pnrId);
we get - notice - no join to segment:
from
upgrade_job u1_0
join
upgrade_request u2_0
on u2_0.id=u1_0.request_id
where
u1_0.status=?
and u2_0.pnr_id=?
We changed the query to explicit fetch:
@Query("select j from UpgradeJob j" +
" join fetch j.upgradeRequest r" +
" join fetch j.upgradeRequest.segment" +
" where j.status = :status and r.pnrId = :pnrId")
List<UpgradeJob> findByStatusAndPnrId(UpgradeJobStatus status, Long pnrId);
so we have join to segment, avoiding N+1:
from
upgrade_job u1_0
join
upgrade_request u2_0
on u2_0.id=u1_0.request_id
join
pnr_segment s1_0
on s1_0.id=u2_0.segment_id
where
u1_0.status=?
and u2_0.pnr_id=?
Could we have at least warning, telling that @EntityGraph will be ignored?
The text was updated successfully, but these errors were encountered:
We noticed that
@EntityGraph(attributePaths = ...)
is ignored when there isfetch
in@Query
.For:
we get - notice - no join to segment:
We changed the query to explicit
fetch
:so we have join to segment, avoiding N+1:
Could we have at least warning, telling that
@EntityGraph
will be ignored?The text was updated successfully, but these errors were encountered: