| After upgrading Hibernate from 5.2.16 to 5.3.3 we are encountering a NullPointerException in FetchStyleLoadPlanBuildingAssociationVisitationStrategy::adjustJoinFetchIfNeeded because the field lockMode is null:
if ( lockMode.greaterThan( LockMode.READ ) ) {
return new FetchStrategy( fetchStrategy.getTiming(), FetchStyle.SELECT );
}
The entity is a single table inheritance entity with multiple implementations, and the exception occurs when lazy loading of the entity proxy is fired. We found out by following the stacktrace that in LegacyBatchingEntityLoaderBuilder.LegacyBatchingEntityLoader the lockMode is set explicitly to null:
public LegacyBatchingEntityLoader(
OuterJoinLoadable persister,
int maxBatchSize,
LockOptions lockOptions,
SessionFactoryImplementor factory,
LoadQueryInfluencers loadQueryInfluencers) {
this( persister, maxBatchSize, null, lockOptions, factory, loadQueryInfluencers );
}
Presumably, instead of null the current value of lockOptions::getLockMode should be passed here. |