HHH-7075 - Use the term 'composition' and 'composite' to refer to components/embeddables

This commit is contained in:
Steve Ebersole 2012-02-17 10:38:20 -06:00
parent 71539da942
commit 9c0d625235
12 changed files with 87 additions and 87 deletions

View File

@ -49,7 +49,7 @@ import org.hibernate.metamodel.spi.binding.AttributeBinding;
import org.hibernate.metamodel.spi.binding.AttributeBindingContainer;
import org.hibernate.metamodel.spi.binding.BasicAttributeBinding;
import org.hibernate.metamodel.spi.binding.BasicPluralAttributeElementBinding;
import org.hibernate.metamodel.spi.binding.CompositionAttributeBinding;
import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.binding.EntityDiscriminator;
import org.hibernate.metamodel.spi.binding.IdGenerator;
@ -61,7 +61,7 @@ import org.hibernate.metamodel.spi.binding.RelationalValueBinding;
import org.hibernate.metamodel.spi.binding.SingularAssociationAttributeBinding;
import org.hibernate.metamodel.spi.binding.SingularAttributeBinding;
import org.hibernate.metamodel.spi.domain.Attribute;
import org.hibernate.metamodel.spi.domain.Composition;
import org.hibernate.metamodel.spi.domain.Composite;
import org.hibernate.metamodel.spi.domain.Entity;
import org.hibernate.metamodel.spi.domain.PluralAttribute;
import org.hibernate.metamodel.spi.domain.SingularAttribute;
@ -722,8 +722,8 @@ public class Binder {
final SingularAttributeBinding referencedAttributeBinding = (SingularAttributeBinding) referencedEntityBinding.locateAttributeBinding(
attributeSource.getReferencedEntityAttributeName()
);
if ( CompositionAttributeBinding.class.isInstance( referencedAttributeBinding ) ) {
collectValues( (CompositionAttributeBinding) referencedAttributeBinding, targetColumns );
if ( CompositeAttributeBinding.class.isInstance( referencedAttributeBinding ) ) {
collectValues( (CompositeAttributeBinding) referencedAttributeBinding, targetColumns );
}
else {
for ( RelationalValueBinding valueBinding :( (BasicAttributeBinding) referencedAttributeBinding ).getRelationalValueBindings() ) {
@ -748,8 +748,8 @@ public class Binder {
return foreignKey;
}
private void collectValues(CompositionAttributeBinding compositionAttributeBinding, List<Value> targetColumns) {
for ( AttributeBinding attributeBinding : compositionAttributeBinding.attributeBindings() ) {
private void collectValues(CompositeAttributeBinding compositeAttributeBinding, List<Value> targetColumns) {
for ( AttributeBinding attributeBinding : compositeAttributeBinding.attributeBindings() ) {
if ( BasicAttributeBinding.class.isInstance( attributeBinding ) ) {
for ( RelationalValueBinding valueBinding :( (BasicAttributeBinding) attributeBinding ).getRelationalValueBindings() ) {
targetColumns.add( valueBinding.getValue() );
@ -760,8 +760,8 @@ public class Binder {
targetColumns.add( valueBinding.getValue() );
}
}
else if ( CompositionAttributeBinding.class.isInstance( attributeBinding ) ) {
collectValues( (CompositionAttributeBinding) attributeBinding, targetColumns );
else if ( CompositeAttributeBinding.class.isInstance( attributeBinding ) ) {
collectValues( (CompositeAttributeBinding) attributeBinding, targetColumns );
}
}
}
@ -818,19 +818,19 @@ public class Binder {
AttributeBindingContainer container,
Deque<TableSpecification> tableStack) {
final String attributeName = attributeSource.getName();
SingularAttribute attribute = container.getAttributeContainer().locateCompositionAttribute( attributeName );
final Composition composition;
SingularAttribute attribute = container.getAttributeContainer().locateCompositeAttribute( attributeName );
final Composite composite;
if ( attribute == null ) {
composition = new Composition(
composite = new Composite(
attributeSource.getPath(),
attributeSource.getClassName(),
attributeSource.getClassReference(),
null // composition inheritance not YET supported
);
attribute = container.getAttributeContainer().createCompositionAttribute( attributeName, composition );
attribute = container.getAttributeContainer().createCompositeAttribute( attributeName, composite );
}
else {
composition = (Composition) attribute.getSingularAttributeType();
composite = (Composite) attribute.getSingularAttributeType();
}
final String propertyAccessorName = Helper.getPropertyAccessorName(
@ -845,13 +845,13 @@ public class Binder {
final SingularAttribute parentReferenceAttribute;
if ( StringHelper.isNotEmpty( attributeSource.getParentReferenceAttributeName() ) ) {
parentReferenceAttribute = composition.createSingularAttribute( attributeSource.getParentReferenceAttributeName() );
parentReferenceAttribute = composite.createSingularAttribute( attributeSource.getParentReferenceAttributeName() );
}
else {
parentReferenceAttribute = null;
}
CompositionAttributeBinding compositionAttributeBinding = container.makeComponentAttributeBinding(
CompositeAttributeBinding compositeAttributeBinding = container.makeComponentAttributeBinding(
attribute,
parentReferenceAttribute,
propertyAccessorName,
@ -860,7 +860,7 @@ public class Binder {
metaAttributeContext
);
bindAttributes( attributeSource, compositionAttributeBinding, tableStack );
bindAttributes( attributeSource, compositeAttributeBinding, tableStack );
}
private void bindPersistentCollection(

View File

@ -39,7 +39,7 @@ import org.hibernate.metamodel.spi.binding.AbstractPluralAttributeBinding;
import org.hibernate.metamodel.spi.binding.AttributeBinding;
import org.hibernate.metamodel.spi.binding.BasicAttributeBinding;
import org.hibernate.metamodel.spi.binding.BasicPluralAttributeElementBinding;
import org.hibernate.metamodel.spi.binding.CompositionAttributeBinding;
import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding;
import org.hibernate.metamodel.spi.binding.HibernateTypeDescriptor;
import org.hibernate.metamodel.spi.binding.IndexedPluralAttributeBinding;
import org.hibernate.metamodel.spi.binding.PluralAttributeBinding;
@ -305,9 +305,9 @@ public class HibernateTypeHelper {
resolvedHibernateType
);
}
else if ( CompositionAttributeBinding.class.isInstance( attributeBinding ) ) {
else if ( CompositeAttributeBinding.class.isInstance( attributeBinding ) ) {
pushHibernateTypeInformationDown(
(CompositionAttributeBinding) attributeBinding,
(CompositeAttributeBinding) attributeBinding,
resolvedHibernateType
);
}
@ -330,7 +330,7 @@ public class HibernateTypeHelper {
@SuppressWarnings( {"UnusedParameters"})
private void pushHibernateTypeInformationDown(
CompositionAttributeBinding attributeBinding,
CompositeAttributeBinding attributeBinding,
Type resolvedHibernateType) {
final HibernateTypeDescriptor hibernateTypeDescriptor = attributeBinding.getHibernateTypeDescriptor();
final SingularAttribute singularAttribute = SingularAttribute.class.cast( attributeBinding.getAttribute() );

View File

@ -33,7 +33,7 @@ import org.hibernate.metamodel.spi.domain.SingularAttribute;
import org.hibernate.metamodel.spi.source.MetaAttributeContext;
/**
* Common contract for {@link EntityBinding} and {@link CompositionAttributeBinding} in so far as they are both
* Common contract for {@link EntityBinding} and {@link CompositeAttributeBinding} in so far as they are both
* containers for {@link AttributeBinding} descriptors
*
* @author Steve Ebersole
@ -92,7 +92,7 @@ public interface AttributeBindingContainer {
*
* @return The attribute binding instance.
*/
public CompositionAttributeBinding makeComponentAttributeBinding(
public CompositeAttributeBinding makeComponentAttributeBinding(
SingularAttribute attribute,
SingularAttribute parentReferenceAttribute,
String propertyAccessorName,

View File

@ -31,7 +31,7 @@ import java.util.Map;
import org.hibernate.mapping.PropertyGeneration;
import org.hibernate.metamodel.spi.domain.AttributeContainer;
import org.hibernate.metamodel.spi.domain.Composition;
import org.hibernate.metamodel.spi.domain.Composite;
import org.hibernate.metamodel.spi.domain.PluralAttribute;
import org.hibernate.metamodel.spi.domain.PluralAttributeNature;
import org.hibernate.metamodel.spi.domain.SingularAttribute;
@ -40,14 +40,14 @@ import org.hibernate.metamodel.spi.source.MetaAttributeContext;
/**
* @author Steve Ebersole
*/
public class CompositionAttributeBinding
public class CompositeAttributeBinding
extends AbstractSingularAttributeBinding
implements AttributeBindingContainer {
private final String path;
private final SingularAttribute parentReference;
private Map<String, AttributeBinding> attributeBindingMap = new HashMap<String, AttributeBinding>();
public CompositionAttributeBinding(
public CompositeAttributeBinding(
AttributeBindingContainer container,
SingularAttribute attribute,
String propertyAccessorName,
@ -98,8 +98,8 @@ public class CompositionAttributeBinding
return getComponent();
}
public Composition getComponent() {
return (Composition) getAttribute().getSingularAttributeType();
public Composite getComponent() {
return (Composite) getAttribute().getSingularAttributeType();
}
@Override
@ -158,14 +158,14 @@ public class CompositionAttributeBinding
}
@Override
public CompositionAttributeBinding makeComponentAttributeBinding(
public CompositeAttributeBinding makeComponentAttributeBinding(
SingularAttribute attribute,
SingularAttribute parentReferenceAttribute,
String propertyAccessorName,
boolean includedInOptimisticLocking,
boolean lazy,
MetaAttributeContext metaAttributeContext) {
final CompositionAttributeBinding binding = new CompositionAttributeBinding(
final CompositeAttributeBinding binding = new CompositeAttributeBinding(
this,
attribute,
propertyAccessorName,

View File

@ -512,14 +512,14 @@ public class EntityBinding implements AttributeBindingContainer {
}
@Override
public CompositionAttributeBinding makeComponentAttributeBinding(
public CompositeAttributeBinding makeComponentAttributeBinding(
SingularAttribute attribute,
SingularAttribute parentReferenceAttribute,
String propertyAccessorName,
boolean includedInOptimisticLocking,
boolean lazy,
MetaAttributeContext metaAttributeContext) {
final CompositionAttributeBinding binding = new CompositionAttributeBinding(
final CompositeAttributeBinding binding = new CompositeAttributeBinding(
this,
attribute,
propertyAccessorName,

View File

@ -112,14 +112,14 @@ public abstract class AbstractAttributeContainer implements AttributeContainer,
}
@Override
public SingularAttribute locateCompositionAttribute(String name) {
public SingularAttribute locateCompositeAttribute(String name) {
return (SingularAttributeImpl) locateAttribute( name );
}
@Override
public SingularAttribute createCompositionAttribute(String name, Composition composition) {
public SingularAttribute createCompositeAttribute(String name, Composite composite) {
SingularAttributeImpl attribute = new SingularAttributeImpl( name, this );
attribute.resolveType( composition );
attribute.resolveType( composite );
addAttribute( attribute );
return attribute;
}

View File

@ -62,8 +62,8 @@ public interface AttributeContainer extends Type {
public SingularAttribute createSingularAttribute(String name);
public SingularAttribute createVirtualSingularAttribute(String name);
public SingularAttribute locateCompositionAttribute(String name);
public SingularAttribute createCompositionAttribute(String name, Composition composition);
public SingularAttribute locateCompositeAttribute(String name);
public SingularAttribute createCompositeAttribute(String name, Composite composite);
public PluralAttribute locatePluralAttribute(String name);

View File

@ -32,8 +32,8 @@ import org.hibernate.internal.util.Value;
*
* @author Steve Ebersole
*/
public class Composition extends AbstractAttributeContainer {
public Composition(String name, String className, Value<Class<?>> classReference, Hierarchical superType) {
public class Composite extends AbstractAttributeContainer {
public Composite(String name, String className, Value<Class<?>> classReference, Hierarchical superType) {
super( name, className, classReference, superType );
}

View File

@ -55,7 +55,7 @@ import org.hibernate.metamodel.spi.binding.AttributeBinding;
import org.hibernate.metamodel.spi.binding.BasicAttributeBinding;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.hibernate.metamodel.spi.domain.Attribute;
import org.hibernate.metamodel.spi.domain.Composition;
import org.hibernate.metamodel.spi.domain.Composite;
import org.hibernate.metamodel.spi.domain.SingularAttribute;
import org.hibernate.tuple.IdentifierProperty;
import org.hibernate.tuple.PropertyFactory;
@ -608,8 +608,8 @@ public class EntityMetamodel implements Serializable {
return ValueInclusion.FULL;
}
// TODO: fix the following when components are working (HHH-6173)
//else if ( mappingProperty.getValue() instanceof CompositionAttributeBinding ) {
// if ( hasPartialInsertComponentGeneration( ( CompositionAttributeBinding ) mappingProperty.getValue() ) ) {
//else if ( mappingProperty.getValue() instanceof CompositeAttributeBinding ) {
// if ( hasPartialInsertComponentGeneration( ( CompositeAttributeBinding ) mappingProperty.getValue() ) ) {
// return ValueInclusion.PARTIAL;
// }
//}
@ -649,8 +649,8 @@ public class EntityMetamodel implements Serializable {
return ValueInclusion.FULL;
}
// TODO: fix the following when components are working (HHH-6173)
//else if ( mappingProperty.getValue() instanceof CompositionAttributeBinding ) {
// if ( hasPartialUpdateComponentGeneration( ( CompositionAttributeBinding ) mappingProperty.getValue() ) ) {
//else if ( mappingProperty.getValue() instanceof CompositeAttributeBinding ) {
// if ( hasPartialUpdateComponentGeneration( ( CompositeAttributeBinding ) mappingProperty.getValue() ) ) {
// return ValueInclusion.PARTIAL;
// }
//}
@ -691,9 +691,9 @@ public class EntityMetamodel implements Serializable {
propertyIndexes.put( attribute.getName(), i );
if ( attribute.isSingular() &&
( ( SingularAttribute ) attribute ).getSingularAttributeType().isComponent() ) {
Composition composition =
(Composition) ( (SingularAttribute) attribute ).getSingularAttributeType();
for ( Attribute subAttribute : composition.attributes() ) {
Composite composite =
(Composite) ( (SingularAttribute) attribute ).getSingularAttributeType();
for ( Attribute subAttribute : composite.attributes() ) {
propertyIndexes.put(
attribute.getName() + '.' + subAttribute.getName(),
i

View File

@ -57,7 +57,7 @@ public class Atmosphere {
@ElementCollection
@Column(name="composition_rate")
@MapKeyJoinColumns( { @MapKeyJoinColumn(name="gas_id" ) } ) //use @MapKeyJoinColumns explicitly for tests
@JoinTable(name = "Composition", joinColumns = @JoinColumn(name = "atmosphere_id"))
@JoinTable(name = "Composite", joinColumns = @JoinColumn(name = "atmosphere_id"))
public Map<Gas, Double> composition = new HashMap<Gas, Double>();
//use default JPA 2 column name for map key

View File

@ -34,7 +34,7 @@ import javax.persistence.Id;
import org.hibernate.annotations.Parent;
import org.hibernate.annotations.Target;
import org.hibernate.metamodel.spi.binding.BasicAttributeBinding;
import org.hibernate.metamodel.spi.binding.CompositionAttributeBinding;
import org.hibernate.metamodel.spi.binding.CompositeAttributeBinding;
import org.hibernate.metamodel.spi.binding.EntityBinding;
import org.junit.Test;
@ -72,8 +72,8 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String componentName = "phone";
assertNotNull( binding.locateAttributeBinding( componentName ) );
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding compositionBinding = (CompositionAttributeBinding) binding.locateAttributeBinding(
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding compositeBinding = (CompositeAttributeBinding) binding.locateAttributeBinding(
componentName
);
@ -81,12 +81,12 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
assertEquals(
"Wrong path",
EmbeddableBindingTest.User.class.getName() + ".phone",
compositionBinding.getPathBase()
compositeBinding.getPathBase()
);
assertNotNull( compositionBinding.locateAttributeBinding( "countryCode" ) );
assertNotNull( compositionBinding.locateAttributeBinding( "areaCode" ) );
assertNotNull( compositionBinding.locateAttributeBinding( "number" ) );
assertNotNull( compositeBinding.locateAttributeBinding( "countryCode" ) );
assertNotNull( compositeBinding.locateAttributeBinding( "areaCode" ) );
assertNotNull( compositeBinding.locateAttributeBinding( "number" ) );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -113,13 +113,13 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String componentName = "embedded";
assertNotNull( binding.locateAttributeBinding( componentName ) );
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding compositionBinding = (CompositionAttributeBinding) binding.locateAttributeBinding(
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding compositeBinding = (CompositeAttributeBinding) binding.locateAttributeBinding(
componentName
);
assertNotNull( compositionBinding.locateAttributeBinding( "name" ) );
BasicAttributeBinding nameAttribute = (BasicAttributeBinding) compositionBinding.locateAttributeBinding( "name" );
assertNotNull( compositeBinding.locateAttributeBinding( "name" ) );
BasicAttributeBinding nameAttribute = (BasicAttributeBinding) compositeBinding.locateAttributeBinding( "name" );
assertEquals( 1, nameAttribute.getRelationalValueBindings().size() );
org.hibernate.metamodel.spi.relational.Column column
= (org.hibernate.metamodel.spi.relational.Column) nameAttribute.getRelationalValueBindings().get( 0 ).getValue();
@ -168,16 +168,16 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String addressComponentName = "address";
assertNotNull( binding.locateAttributeBinding( addressComponentName ) );
assertTrue( binding.locateAttributeBinding( addressComponentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding attributeCompositionBinding = (CompositionAttributeBinding) binding.locateAttributeBinding(
assertTrue( binding.locateAttributeBinding( addressComponentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding attributeCompositeBinding = (CompositeAttributeBinding) binding.locateAttributeBinding(
addressComponentName
);
assertNotNull( attributeCompositionBinding.locateAttributeBinding( "street" ) );
assertNotNull( attributeCompositionBinding.locateAttributeBinding( "city" ) );
assertNotNull( attributeCompositionBinding.locateAttributeBinding( "state" ) );
assertNotNull( attributeCompositeBinding.locateAttributeBinding( "street" ) );
assertNotNull( attributeCompositeBinding.locateAttributeBinding( "city" ) );
assertNotNull( attributeCompositeBinding.locateAttributeBinding( "state" ) );
BasicAttributeBinding stateAttribute = (BasicAttributeBinding) attributeCompositionBinding.locateAttributeBinding(
BasicAttributeBinding stateAttribute = (BasicAttributeBinding) attributeCompositeBinding.locateAttributeBinding(
"state"
);
assertEquals( 1, stateAttribute.getRelationalValueBindings().size() );
@ -191,13 +191,13 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String zipComponentName = "zipcode";
assertNotNull( attributeCompositionBinding.locateAttributeBinding( zipComponentName ) );
assertTrue( attributeCompositionBinding.locateAttributeBinding( zipComponentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding zipCompositionBinding = (CompositionAttributeBinding) attributeCompositionBinding.locateAttributeBinding(
assertNotNull( attributeCompositeBinding.locateAttributeBinding( zipComponentName ) );
assertTrue( attributeCompositeBinding.locateAttributeBinding( zipComponentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding zipCompositeBinding = (CompositeAttributeBinding) attributeCompositeBinding.locateAttributeBinding(
zipComponentName
);
BasicAttributeBinding nameAttribute = (BasicAttributeBinding) zipCompositionBinding.locateAttributeBinding( "zip" );
BasicAttributeBinding nameAttribute = (BasicAttributeBinding) zipCompositeBinding.locateAttributeBinding( "zip" );
assertEquals( 1, nameAttribute.getRelationalValueBindings().size() );
column = (org.hibernate.metamodel.spi.relational.Column) nameAttribute.getRelationalValueBindings().get( 0 ).getValue();
assertEquals(
@ -262,19 +262,19 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String aComponentName = "a";
assertNotNull( binding.locateAttributeBinding( aComponentName ) );
assertTrue( binding.locateAttributeBinding( aComponentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding aCompositionBinding = (CompositionAttributeBinding) binding.locateAttributeBinding(
assertTrue( binding.locateAttributeBinding( aComponentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding aCompositeBinding = (CompositeAttributeBinding) binding.locateAttributeBinding(
aComponentName
);
final String bComponentName = "b";
assertNotNull( aCompositionBinding.locateAttributeBinding( bComponentName ) );
assertTrue( aCompositionBinding.locateAttributeBinding( bComponentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding bCompositionBinding = (CompositionAttributeBinding) aCompositionBinding.locateAttributeBinding(
assertNotNull( aCompositeBinding.locateAttributeBinding( bComponentName ) );
assertTrue( aCompositeBinding.locateAttributeBinding( bComponentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding bCompositeBinding = (CompositeAttributeBinding) aCompositeBinding.locateAttributeBinding(
bComponentName
);
BasicAttributeBinding attribute = (BasicAttributeBinding) bCompositionBinding.locateAttributeBinding( "foo" );
BasicAttributeBinding attribute = (BasicAttributeBinding) bCompositeBinding.locateAttributeBinding( "foo" );
assertEquals( 1, attribute.getRelationalValueBindings().size() );
org.hibernate.metamodel.spi.relational.Column column
= (org.hibernate.metamodel.spi.relational.Column) attribute.getRelationalValueBindings().get( 0 ).getValue();
@ -284,7 +284,7 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
column.getColumnName().getName()
);
attribute = (BasicAttributeBinding) bCompositionBinding.locateAttributeBinding( "fubar" );
attribute = (BasicAttributeBinding) bCompositeBinding.locateAttributeBinding( "fubar" );
assertEquals( 1, attribute.getRelationalValueBindings().size() );
column = (org.hibernate.metamodel.spi.relational.Column) attribute.getRelationalValueBindings().get( 0 ).getValue();
assertEquals(
@ -319,12 +319,12 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String componentName = "embedded";
assertNotNull( binding.locateAttributeBinding( componentName ) );
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding compositionBinding = (CompositionAttributeBinding) binding.locateAttributeBinding(
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding compositeBinding = (CompositeAttributeBinding) binding.locateAttributeBinding(
componentName
);
assertEquals( "Wrong parent reference name", "parent", compositionBinding.getParentReference().getName() );
assertEquals( "Wrong parent reference name", "parent", compositeBinding.getParentReference().getName() );
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -365,12 +365,12 @@ public class EmbeddableBindingTest extends BaseAnnotationBindingTestCase {
final String componentName = "car";
assertNotNull( binding.locateAttributeBinding( componentName ) );
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositionAttributeBinding );
CompositionAttributeBinding compositionBinding = (CompositionAttributeBinding) binding.locateAttributeBinding(
assertTrue( binding.locateAttributeBinding( componentName ) instanceof CompositeAttributeBinding );
CompositeAttributeBinding compositeBinding = (CompositeAttributeBinding) binding.locateAttributeBinding(
componentName
);
BasicAttributeBinding attribute = (BasicAttributeBinding) compositionBinding.locateAttributeBinding( "horsePower" );
BasicAttributeBinding attribute = (BasicAttributeBinding) compositeBinding.locateAttributeBinding( "horsePower" );
assertTrue( attribute.getAttribute().isTypeResolved() );
assertEquals(
"Wrong resolved type",

View File

@ -137,12 +137,12 @@ public abstract class AbstractBasicBindingTests extends BaseUnitTestCase {
assertRoot( metadata, entityBinding );
assertIdAndSimpleProperty( entityBinding );
CompositionAttributeBinding compositionAttributeBinding = (CompositionAttributeBinding) entityBinding.locateAttributeBinding( "simpleComponent" );
assertNotNull( compositionAttributeBinding );
assertSame( compositionAttributeBinding.getAttribute().getSingularAttributeType(), compositionAttributeBinding.getAttributeContainer() );
assertEquals( SimpleEntityWithSimpleComponent.class.getName() + ".simpleComponent", compositionAttributeBinding.getPathBase() );
assertSame( entityBinding, compositionAttributeBinding.seekEntityBinding() );
assertNotNull( compositionAttributeBinding.getComponent() );
CompositeAttributeBinding compositeAttributeBinding = (CompositeAttributeBinding) entityBinding.locateAttributeBinding( "simpleComponent" );
assertNotNull( compositeAttributeBinding );
assertSame( compositeAttributeBinding.getAttribute().getSingularAttributeType(), compositeAttributeBinding.getAttributeContainer() );
assertEquals( SimpleEntityWithSimpleComponent.class.getName() + ".simpleComponent", compositeAttributeBinding.getPathBase() );
assertSame( entityBinding, compositeAttributeBinding.seekEntityBinding() );
assertNotNull( compositeAttributeBinding.getComponent() );
}
public abstract void addSourcesForSimpleVersionedEntityBinding(MetadataSources sources);