HHH-6159 - Create EntityManagerFactoryBuilder : fixed failures hidden behind 'use new metamodel flag' not being true

This commit is contained in:
Steve Ebersole 2012-07-24 16:20:21 -05:00
parent 5932915b68
commit df74a4d55f
5 changed files with 9 additions and 22 deletions

View File

@ -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<Y, Object> attribute = buildAttribute( embeddableType, subAttributeBinding );
if ( attribute != null ) {

View File

@ -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();

View File

@ -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<X,Y,E>
}
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<X,Y,E>
// 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()

View File

@ -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<X,Y>
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();

View File

@ -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();