We're updating the issue view to help you get more done. 

NullPointerException in FetchStyleLoadPlanBuildingAssociationVisitationStrategy::adjustJoinFetchIfNeeded

Description

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:

1 2 3 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:

1 2 3 4 5 6 7 8 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.

Environment

None

Status

Assignee

Guillaume Smet

Reporter

Mirko Adebahr

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.3.3

Priority

Major