diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java index 1899f2ee8c..e57a618c25 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeBuilder.java @@ -242,9 +242,8 @@ public class AttributeBuilder { (ComponentType) attributeTypeDescriptor.getHibernateType() ); context.registerEmbeddedableType( embeddableType ); - CompositeAttributeBinding compositeAttributeBinding = - (CompositeAttributeBinding) attributeTypeDescriptor.getHibernateMetamodelType(); + (CompositeAttributeBinding) attributeTypeDescriptor.getAttributeMetadata().getAttributeBinding(); for ( AttributeBinding subAttributeBinding : compositeAttributeBinding.attributeBindings() ) { final Attribute attribute = buildAttribute( embeddableType, subAttributeBinding ); if ( attribute != null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeTypeDescriptor.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeTypeDescriptor.java index 53bbb95174..e283bf9776 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeTypeDescriptor.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/AttributeTypeDescriptor.java @@ -40,8 +40,6 @@ public interface AttributeTypeDescriptor { BASIC } - public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType(); - public org.hibernate.type.Type getHibernateType(); public Class getBindableType(); diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java index d63b63f20d..eea0730eb5 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/PluralAttributeMetadataImpl.java @@ -31,7 +31,6 @@ import java.lang.reflect.TypeVariable; import org.hibernate.annotations.common.AssertionFailure; import org.hibernate.jpa.metamodel.internal.AbstractManagedType; -import org.hibernate.metamodel.spi.binding.IndexedPluralAttributeBinding; import org.hibernate.metamodel.spi.binding.PluralAttributeBinding; /** @@ -77,11 +76,6 @@ public class PluralAttributeMetadataImpl } this.elementAttributeTypeDescriptor = new AttributeTypeDescriptor() { - @Override - public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType() { - return getAttributeBinding().getAttribute().getElementType(); - } - @Override public org.hibernate.type.Type getHibernateType() { return getAttributeBinding().getPluralAttributeElementBinding() @@ -115,12 +109,6 @@ public class PluralAttributeMetadataImpl // interpret the key, if one if ( keyPersistentAttributeType != null ) { this.keyAttributeTypeDescriptor = new AttributeTypeDescriptor() { - @Override - public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType() { - return ( (IndexedPluralAttributeBinding) getAttributeBinding() ).getPluralAttributeIndexBinding() - .getPluralAttributeIndexType(); - } - @Override public org.hibernate.type.Type getHibernateType() { return getAttributeBinding().getPluralAttributeKeyBinding() diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java index c14921ac2f..7e152eecb3 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/metamodel/internal/builder/SingularAttributeMetadataImpl.java @@ -28,7 +28,6 @@ import java.lang.reflect.Member; import org.hibernate.jpa.metamodel.internal.AbstractManagedType; import org.hibernate.metamodel.spi.binding.AttributeBinding; -import org.hibernate.metamodel.spi.domain.SingularAttribute; /** * @author Steve Ebersole @@ -45,11 +44,6 @@ public class SingularAttributeMetadataImpl Attribute.PersistentAttributeType persistentAttributeType) { super( attributeBinding, ownerType, member, persistentAttributeType ); attributeTypeDescriptor = new AttributeTypeDescriptor() { - @Override - public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType() { - return ( (SingularAttribute) getAttributeMetadata().getAttributeBinding().getAttribute() ).getSingularAttributeType(); - } - @Override public org.hibernate.type.Type getHibernateType() { return getAttributeMetadata().getAttributeBinding().getHibernateTypeDescriptor().getResolvedTypeMapping(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/discriminator/DiscriminatorTest.java b/hibernate-core/src/test/java/org/hibernate/test/discriminator/DiscriminatorTest.java index f54b7315ff..eae8b0d882 100755 --- a/hibernate-core/src/test/java/org/hibernate/test/discriminator/DiscriminatorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/discriminator/DiscriminatorTest.java @@ -30,6 +30,8 @@ import org.junit.Test; import org.hibernate.Hibernate; import org.hibernate.Session; import org.hibernate.Transaction; +import org.hibernate.cfg.AvailableSettings; +import org.hibernate.cfg.Configuration; import org.hibernate.criterion.Property; import org.hibernate.criterion.Restrictions; import org.hibernate.proxy.HibernateProxy; @@ -51,6 +53,12 @@ public class DiscriminatorTest extends BaseCoreFunctionalTestCase { return new String[] { "discriminator/Person.hbm.xml" }; } + @Override + protected void configure(Configuration configuration) { + super.configure( configuration ); + configuration.setProperty( USE_NEW_METADATA_MAPPINGS, "true" ); + } + @Test public void testDiscriminatorSubclass() { Session s = openSession();