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 703efb1876..5be0e8c1d6 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 @@ -269,7 +269,7 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { final Value originalValue = prop.getValue(); if ( originalValue instanceof SimpleValue ) { // Avoid copying when the property doesn't depend on a type variable - if ( inferredData.getTypeName().equals( getTypeName( originalValue ) ) ) { + if ( inferredData.getTypeName().equals( getTypeName( prop ) ) ) { superclass.addDeclaredProperty( prop ); return; } @@ -329,6 +329,11 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { } } + static String getTypeName(Property property) { + final String typeName = getTypeName( property.getValue() ); + return typeName != null ? typeName : property.getReturnedClassName(); + } + static String getTypeName(Value value) { if ( value instanceof Component ) { final Component component = (Component) value; diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java index 2d418329e5..43bd70b1f6 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java @@ -365,7 +365,7 @@ public class PropertyBinder { final Value originalValue = prop.getValue(); if ( originalValue instanceof SimpleValue ) { // Avoid copying when the property doesn't depend on a type variable - if ( inferredData.getTypeName().equals( ClassPropertyHolder.getTypeName( originalValue ) ) ) { + if ( inferredData.getTypeName().equals( ClassPropertyHolder.getTypeName( prop ) ) ) { superclass.setDeclaredIdentifierProperty( prop ); return; }