Uploaded image for project: 'Hibernate ORM'
  1. HHH-12847

NullPointerException in FetchStyleLoadPlanBuildingAssociationVisitationStrategy::adjustJoinFetchIfNeeded

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.3.3
    • Fix Version/s: 5.3.4, 5.4.0
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      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:

      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.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: