Skip to content

Commit bf440a4

Browse files
gbadnersebersole
authored andcommitted
HHH-8276 - Fix NullPointerException when hibernate.max_fetch_depth is not configured
1 parent edc4a04 commit bf440a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

hibernate-core/src/main/java/org/hibernate/loader/plan2/build/internal/FetchStyleLoadPlanBuildingAssociationVisitationStrategy.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ protected FetchStrategy determineFetchStrategy(AssociationAttributeDefinition at
106106
protected FetchStrategy adjustJoinFetchIfNeeded(
107107
AssociationAttributeDefinition attributeDefinition,
108108
FetchStrategy fetchStrategy) {
109-
if ( currentDepth() > sessionFactory().getSettings().getMaximumFetchDepth() ) {
109+
final Integer maxFetchDepth = sessionFactory().getSettings().getMaximumFetchDepth();
110+
if ( maxFetchDepth != null && currentDepth() > maxFetchDepth ) {
110111
return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
111112
}
112113

0 commit comments

Comments
 (0)