@@ -932,10 +932,7 @@ public void resolveInstance(Object instance, EntityInitializerData data) {
932
932
// Entity is most probably initialized
933
933
data .entityInstanceForNotify = instance ;
934
934
data .concreteDescriptor = session .getEntityPersister ( null , instance );
935
- resolveEntityKey (
936
- data ,
937
- data .concreteDescriptor .getIdentifier ( instance , session )
938
- );
935
+ resolveEntityKey ( data , data .concreteDescriptor .getIdentifier ( instance , session ) );
939
936
data .entityHolder = persistenceContext .getEntityHolder ( data .entityKey );
940
937
if ( data .entityHolder == null ) {
941
938
// Entity was most probably removed in the same session without setting this association to null.
@@ -950,7 +947,8 @@ public void resolveInstance(Object instance, EntityInitializerData data) {
950
947
}
951
948
if ( data .concreteDescriptor .getBytecodeEnhancementMetadata ().isEnhancedForLazyLoading ()
952
949
&& isPersistentAttributeInterceptable ( data .entityInstanceForNotify )
953
- && getAttributeInterceptor ( data .entityInstanceForNotify ) instanceof EnhancementAsProxyLazinessInterceptor enhancementInterceptor
950
+ && getAttributeInterceptor ( data .entityInstanceForNotify )
951
+ instanceof EnhancementAsProxyLazinessInterceptor enhancementInterceptor
954
952
&& !enhancementInterceptor .isInitialized () ) {
955
953
data .setState ( State .RESOLVED );
956
954
}
@@ -1033,14 +1031,14 @@ public void resolveInstance(EntityInitializerData data) {
1033
1031
}
1034
1032
resolveEntityKey ( data , id );
1035
1033
}
1036
- final PersistenceContext persistenceContext = rowProcessingState . getSession ()
1037
- . getPersistenceContextInternal ();
1038
- data . entityHolder = persistenceContext .claimEntityHolderIfPossible (
1039
- data .entityKey ,
1040
- null ,
1041
- rowProcessingState .getJdbcValuesSourceProcessingState (),
1042
- this
1043
- );
1034
+ data . entityHolder =
1035
+ rowProcessingState . getSession (). getPersistenceContextInternal ()
1036
+ .claimEntityHolderIfPossible (
1037
+ data .entityKey ,
1038
+ null ,
1039
+ rowProcessingState .getJdbcValuesSourceProcessingState (),
1040
+ this
1041
+ );
1044
1042
1045
1043
if ( useEmbeddedIdentifierInstanceAsEntity ( data ) ) {
1046
1044
data .setInstance ( data .entityInstanceForNotify = rowProcessingState .getEntityId () );
@@ -1078,8 +1076,9 @@ public void resolveInstance(EntityInitializerData data) {
1078
1076
1079
1077
protected void resolveEntityInstance1 (EntityInitializerData data ) {
1080
1078
final Object proxy = data .entityHolder .getProxy ();
1081
- final boolean unwrapProxy = proxy != null && referencedModelPart instanceof ToOneAttributeMapping
1082
- && ( (ToOneAttributeMapping ) referencedModelPart ).isUnwrapProxy ()
1079
+ final boolean unwrapProxy = proxy != null
1080
+ && referencedModelPart instanceof ToOneAttributeMapping toOneAttributeMapping
1081
+ && toOneAttributeMapping .isUnwrapProxy ()
1083
1082
&& getConcreteDescriptor ( data ).getBytecodeEnhancementMetadata ().isEnhancedForLazyLoading ();
1084
1083
final Object entityFromExecutionContext ;
1085
1084
if ( !unwrapProxy && isProxyInstance ( proxy ) ) {
@@ -1265,18 +1264,18 @@ else if ( entityDescriptor.canUseReferenceCacheEntries() ) {
1265
1264
}
1266
1265
1267
1266
protected Object instantiateEntity (EntityInitializerData data ) {
1268
- return data .getRowProcessingState ().getSession ().instantiate (
1269
- data .concreteDescriptor ,
1270
- data .entityKey .getIdentifier ()
1271
- );
1267
+ return data .getRowProcessingState ().getSession ()
1268
+ .instantiate ( data .concreteDescriptor , data .entityKey .getIdentifier () );
1272
1269
}
1273
1270
1274
1271
private Object resolveToOptionalInstance (EntityInitializerData data ) {
1275
1272
if ( isResultInitializer () ) {
1276
1273
// this isEntityReturn bit is just for entity loaders, not hql/criteria
1277
1274
final JdbcValuesSourceProcessingOptions processingOptions =
1278
1275
data .getRowProcessingState ().getJdbcValuesSourceProcessingState ().getProcessingOptions ();
1279
- return matchesOptionalInstance ( data , processingOptions ) ? processingOptions .getEffectiveOptionalObject () : null ;
1276
+ return matchesOptionalInstance ( data , processingOptions )
1277
+ ? processingOptions .getEffectiveOptionalObject ()
1278
+ : null ;
1280
1279
}
1281
1280
else {
1282
1281
return null ;
@@ -1289,8 +1288,8 @@ private boolean matchesOptionalInstance(
1289
1288
final Object optionalEntityInstance = processingOptions .getEffectiveOptionalObject ();
1290
1289
final Object requestedEntityId = processingOptions .getEffectiveOptionalId ();
1291
1290
return requestedEntityId != null
1292
- && optionalEntityInstance != null
1293
- && areKeysEqual ( requestedEntityId , data .entityKey .getIdentifier () );
1291
+ && optionalEntityInstance != null
1292
+ && areKeysEqual ( requestedEntityId , data .entityKey .getIdentifier () );
1294
1293
}
1295
1294
1296
1295
private Object resolveInstanceFromCache (EntityInitializerData data ) {
0 commit comments