HHH-6159 - Create EntityManagerFactoryBuilder : fixed failures hidden behind 'use new metamodel flag' not being true
This commit is contained in:
parent
5932915b68
commit
df74a4d55f
|
@ -242,9 +242,8 @@ public class AttributeBuilder {
|
||||||
(ComponentType) attributeTypeDescriptor.getHibernateType()
|
(ComponentType) attributeTypeDescriptor.getHibernateType()
|
||||||
);
|
);
|
||||||
context.registerEmbeddedableType( embeddableType );
|
context.registerEmbeddedableType( embeddableType );
|
||||||
|
|
||||||
CompositeAttributeBinding compositeAttributeBinding =
|
CompositeAttributeBinding compositeAttributeBinding =
|
||||||
(CompositeAttributeBinding) attributeTypeDescriptor.getHibernateMetamodelType();
|
(CompositeAttributeBinding) attributeTypeDescriptor.getAttributeMetadata().getAttributeBinding();
|
||||||
for ( AttributeBinding subAttributeBinding : compositeAttributeBinding.attributeBindings() ) {
|
for ( AttributeBinding subAttributeBinding : compositeAttributeBinding.attributeBindings() ) {
|
||||||
final Attribute<Y, Object> attribute = buildAttribute( embeddableType, subAttributeBinding );
|
final Attribute<Y, Object> attribute = buildAttribute( embeddableType, subAttributeBinding );
|
||||||
if ( attribute != null ) {
|
if ( attribute != null ) {
|
||||||
|
|
|
@ -40,8 +40,6 @@ public interface AttributeTypeDescriptor {
|
||||||
BASIC
|
BASIC
|
||||||
}
|
}
|
||||||
|
|
||||||
public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType();
|
|
||||||
|
|
||||||
public org.hibernate.type.Type getHibernateType();
|
public org.hibernate.type.Type getHibernateType();
|
||||||
|
|
||||||
public Class getBindableType();
|
public Class getBindableType();
|
||||||
|
|
|
@ -31,7 +31,6 @@ import java.lang.reflect.TypeVariable;
|
||||||
|
|
||||||
import org.hibernate.annotations.common.AssertionFailure;
|
import org.hibernate.annotations.common.AssertionFailure;
|
||||||
import org.hibernate.jpa.metamodel.internal.AbstractManagedType;
|
import org.hibernate.jpa.metamodel.internal.AbstractManagedType;
|
||||||
import org.hibernate.metamodel.spi.binding.IndexedPluralAttributeBinding;
|
|
||||||
import org.hibernate.metamodel.spi.binding.PluralAttributeBinding;
|
import org.hibernate.metamodel.spi.binding.PluralAttributeBinding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -77,11 +76,6 @@ public class PluralAttributeMetadataImpl<X,Y,E>
|
||||||
}
|
}
|
||||||
|
|
||||||
this.elementAttributeTypeDescriptor = new AttributeTypeDescriptor() {
|
this.elementAttributeTypeDescriptor = new AttributeTypeDescriptor() {
|
||||||
@Override
|
|
||||||
public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType() {
|
|
||||||
return getAttributeBinding().getAttribute().getElementType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.hibernate.type.Type getHibernateType() {
|
public org.hibernate.type.Type getHibernateType() {
|
||||||
return getAttributeBinding().getPluralAttributeElementBinding()
|
return getAttributeBinding().getPluralAttributeElementBinding()
|
||||||
|
@ -115,12 +109,6 @@ public class PluralAttributeMetadataImpl<X,Y,E>
|
||||||
// interpret the key, if one
|
// interpret the key, if one
|
||||||
if ( keyPersistentAttributeType != null ) {
|
if ( keyPersistentAttributeType != null ) {
|
||||||
this.keyAttributeTypeDescriptor = new AttributeTypeDescriptor() {
|
this.keyAttributeTypeDescriptor = new AttributeTypeDescriptor() {
|
||||||
@Override
|
|
||||||
public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType() {
|
|
||||||
return ( (IndexedPluralAttributeBinding) getAttributeBinding() ).getPluralAttributeIndexBinding()
|
|
||||||
.getPluralAttributeIndexType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.hibernate.type.Type getHibernateType() {
|
public org.hibernate.type.Type getHibernateType() {
|
||||||
return getAttributeBinding().getPluralAttributeKeyBinding()
|
return getAttributeBinding().getPluralAttributeKeyBinding()
|
||||||
|
|
|
@ -28,7 +28,6 @@ import java.lang.reflect.Member;
|
||||||
|
|
||||||
import org.hibernate.jpa.metamodel.internal.AbstractManagedType;
|
import org.hibernate.jpa.metamodel.internal.AbstractManagedType;
|
||||||
import org.hibernate.metamodel.spi.binding.AttributeBinding;
|
import org.hibernate.metamodel.spi.binding.AttributeBinding;
|
||||||
import org.hibernate.metamodel.spi.domain.SingularAttribute;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
|
@ -45,11 +44,6 @@ public class SingularAttributeMetadataImpl<X,Y>
|
||||||
Attribute.PersistentAttributeType persistentAttributeType) {
|
Attribute.PersistentAttributeType persistentAttributeType) {
|
||||||
super( attributeBinding, ownerType, member, persistentAttributeType );
|
super( attributeBinding, ownerType, member, persistentAttributeType );
|
||||||
attributeTypeDescriptor = new AttributeTypeDescriptor() {
|
attributeTypeDescriptor = new AttributeTypeDescriptor() {
|
||||||
@Override
|
|
||||||
public org.hibernate.metamodel.spi.domain.Type getHibernateMetamodelType() {
|
|
||||||
return ( (SingularAttribute) getAttributeMetadata().getAttributeBinding().getAttribute() ).getSingularAttributeType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public org.hibernate.type.Type getHibernateType() {
|
public org.hibernate.type.Type getHibernateType() {
|
||||||
return getAttributeMetadata().getAttributeBinding().getHibernateTypeDescriptor().getResolvedTypeMapping();
|
return getAttributeMetadata().getAttributeBinding().getHibernateTypeDescriptor().getResolvedTypeMapping();
|
||||||
|
|
|
@ -30,6 +30,8 @@ import org.junit.Test;
|
||||||
import org.hibernate.Hibernate;
|
import org.hibernate.Hibernate;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.criterion.Property;
|
import org.hibernate.criterion.Property;
|
||||||
import org.hibernate.criterion.Restrictions;
|
import org.hibernate.criterion.Restrictions;
|
||||||
import org.hibernate.proxy.HibernateProxy;
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
|
@ -51,6 +53,12 @@ public class DiscriminatorTest extends BaseCoreFunctionalTestCase {
|
||||||
return new String[] { "discriminator/Person.hbm.xml" };
|
return new String[] { "discriminator/Person.hbm.xml" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(Configuration configuration) {
|
||||||
|
super.configure( configuration );
|
||||||
|
configuration.setProperty( USE_NEW_METADATA_MAPPINGS, "true" );
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDiscriminatorSubclass() {
|
public void testDiscriminatorSubclass() {
|
||||||
Session s = openSession();
|
Session s = openSession();
|
||||||
|
|
Loading…
Reference in New Issue