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 c2fd57c7f0..da96b8a539 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 @@ -363,14 +363,19 @@ public class ClassPropertyHolder extends AbstractPropertyHolder { actualProperty.setValue( context.getMetadataCollector().getGenericComponent( componentClass ) ); } else { - final Iterator propertyIterator = component.getPropertyIterator(); - while ( propertyIterator.hasNext() ) { - Property property = propertyIterator.next(); - try { - property.getGetter( componentClass ); - } - catch (PropertyNotFoundException e) { - propertyIterator.remove(); + if ( componentClass == Object.class ) { + // Object is not a valid component class, but that is what we get when using a type variable + component.getProperties().clear(); + } + else { + final Iterator propertyIterator = component.getPropertyIterator(); + while ( propertyIterator.hasNext() ) { + try { + propertyIterator.next().getGetter( componentClass ); + } + catch (PropertyNotFoundException e) { + propertyIterator.remove(); + } } } } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java index 89753fcff7..ca2b12dcd6 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/EmbeddableRepresentationStrategyPojo.java @@ -32,7 +32,6 @@ import org.hibernate.property.access.internal.PropertyAccessStrategyIndexBackRef import org.hibernate.property.access.spi.BuiltInPropertyAccessStrategies; import org.hibernate.property.access.spi.PropertyAccess; import org.hibernate.property.access.spi.PropertyAccessStrategy; -import org.hibernate.service.ServiceRegistry; import org.hibernate.type.descriptor.java.JavaType; import org.hibernate.type.descriptor.java.spi.JavaTypeRegistry; import org.hibernate.type.internal.CompositeUserTypeJavaTypeWrapper;