HHH-16532 Fix NPE for @Any association fetches

This commit is contained in:
Marco Belladelli 2023-05-24 10:32:57 +02:00
parent 43429d29ed
commit 0aabdb189f
No known key found for this signature in database
GPG Key ID: D1D0C3030AE3AA35
1 changed files with 5 additions and 4 deletions

View File

@ -887,10 +887,11 @@ public class LoaderSelectBuilder {
}
}
else if ( loadQueryInfluencers.getEnabledCascadingFetchProfile() != null ) {
final CascadeStyle cascadeStyle = fetchable.asAttributeMapping().getAttributeMetadata()
.getCascadeStyle();
final CascadingAction<?> cascadingAction = loadQueryInfluencers.getEnabledCascadingFetchProfile()
.getCascadingAction();
final CascadeStyle cascadeStyle = fetchable.asAttributeMapping() != null ?
fetchable.asAttributeMapping().getAttributeMetadata().getCascadeStyle() :
null;
final CascadingAction<?> cascadingAction =
loadQueryInfluencers.getEnabledCascadingFetchProfile().getCascadingAction();
if ( cascadeStyle == null || cascadeStyle.doCascade( cascadingAction ) ) {
fetchTiming = FetchTiming.IMMEDIATE;
// In 5.x the CascadeEntityJoinWalker only join fetched the first collection fetch