From 87a40f6c2f9155172ba87972db2676114a685e75 Mon Sep 17 00:00:00 2001 From: Chris Cranford Date: Tue, 9 Mar 2021 14:00:54 -0500 Subject: [PATCH] Set strategySelector before reflectionOptimizer is resolved --- .../internal/StandardPojoEntityRepresentationStrategy.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java index faecc46bc4..eb06b2a61f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/StandardPojoEntityRepresentationStrategy.java @@ -137,6 +137,9 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent } this.proxyFactory = proxyFactory; + // resolveReflectionOptimizer may lead to a makePropertyAccess call which requires strategySelector + this.strategySelector = sessionFactory.getServiceRegistry().getService( StrategySelector.class ); + this.reflectionOptimizer = resolveReflectionOptimizer( bootDescriptor, bytecodeProvider, sessionFactory ); if ( reflectionOptimizer != null ) { @@ -151,8 +154,6 @@ public class StandardPojoEntityRepresentationStrategy implements EntityRepresent else { this.instantiator = new PojoInstantiatorImpl<>( mappedJtd ); } - - this.strategySelector = sessionFactory.getServiceRegistry().getService( StrategySelector.class ); } private PropertyAccess resolveIdentifierPropertyAccess(PersistentClass bootDescriptor) {