HHH-10956 reduced runtime complexity, added Component.getProperty(int)
Component.getProperty(String) was looping and comparing, but we already now the position of the property
This commit is contained in:
parent
2db3ce2643
commit
0804de87b4
|
@ -342,6 +342,18 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
return java.util.Collections.unmodifiableMap( tuplizerImpls );
|
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 {
|
public Property getProperty(String propertyName) throws MappingException {
|
||||||
Iterator iter = getPropertyIterator();
|
Iterator iter = getPropertyIterator();
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() ) {
|
||||||
|
|
|
@ -377,8 +377,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
if ( subType.isAssociationType() ) {
|
if ( subType.isAssociationType() ) {
|
||||||
throw new HibernateException( "No part of a composite identifier may be null" );
|
throw new HibernateException( "No part of a composite identifier may be null" );
|
||||||
}
|
}
|
||||||
final String name = names[i];
|
final Property p = ( (Component) identifier ).getProperty( i );
|
||||||
final Property p = ( (Component) identifier ).getProperty( name );
|
|
||||||
final SimpleValue v = (SimpleValue) p.getValue();
|
final SimpleValue v = (SimpleValue) p.getValue();
|
||||||
if ( v.getIdentifierGenerator() == null ) {
|
if ( v.getIdentifierGenerator() == null ) {
|
||||||
throw new HibernateException( "No part of a composite identifier may be null" );
|
throw new HibernateException( "No part of a composite identifier may be null" );
|
||||||
|
|
Loading…
Reference in New Issue