diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java index f988a8ba4e..a60d6eea3d 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java @@ -342,6 +342,18 @@ public class Component extends SimpleValue implements MetaAttributable { return java.util.Collections.unmodifiableMap( tuplizerImpls ); } + /** + * Returns the {@link Property} at the specified position in this {@link Component}. + * + * @param index index of the {@link Property} to return + * @return {@link Property} + * @throws IndexOutOfBoundsException - if the index is out of range(index < 0 || index >= + * {@link #getPropertySpan()}) + */ + public Property getProperty(int index) { + return properties.get( index ); + } + public Property getProperty(String propertyName) throws MappingException { Iterator iter = getPropertyIterator(); while ( iter.hasNext() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java index 61066326d7..c6509b472a 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/AbstractEntityTuplizer.java @@ -377,8 +377,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer { if ( subType.isAssociationType() ) { throw new HibernateException( "No part of a composite identifier may be null" ); } - final String name = names[i]; - final Property p = ( (Component) identifier ).getProperty( name ); + final Property p = ( (Component) identifier ).getProperty( i ); final SimpleValue v = (SimpleValue) p.getValue(); if ( v.getIdentifierGenerator() == null ) { throw new HibernateException( "No part of a composite identifier may be null" );