From d8e0ecfbf869e2d98a5d3056024ec3b6fc29a6a8 Mon Sep 17 00:00:00 2001 From: Marco Belladelli Date: Thu, 4 Apr 2024 15:46:57 +0200 Subject: [PATCH] HHH-17916 Check type is resolved before building generic property --- .../boot/model/internal/ClassPropertyHolder.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ClassPropertyHolder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ClassPropertyHolder.java index 69f06424fd..16ec453783 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ClassPropertyHolder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/ClassPropertyHolder.java @@ -326,13 +326,10 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { null, context.getBootstrapContext().getReflectionManager() ); - final Value originalValue = prop.getValue(); - if ( originalValue instanceof SimpleValue ) { + if ( declaredProperty.isTypeResolved() ) { // Avoid copying when the property doesn't depend on a type variable - if ( inferredData.getTypeName().equals( getTypeName( prop ) ) ) { - propertyConsumer.accept( prop ); - return; - } + propertyConsumer.accept( prop ); + return; } // If the property depends on a type variable, we have to copy it and the Value final Property actualProperty = prop.copy(); @@ -348,6 +345,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { // collection.setOwner( null ); collection.setRole( type.getName() + "." + prop.getName() ); // To copy the element and key values, we need to defer setting the type name until the CollectionBinder ran + final Value originalValue = prop.getValue(); context.getMetadataCollector().addSecondPass( new SecondPass() { @Override