HHH-8950 Avoid repeated array allocation for sqlTypes

This commit is contained in:
Sanne Grinovero 2014-02-09 22:36:41 +00:00 committed by Brett Meyer
parent 419633432a
commit b12f2ecf44
1 changed files with 6 additions and 2 deletions

View File

@ -62,9 +62,12 @@ public abstract class AbstractStandardBasicType<T>
// by DynamicParameterizedTypes.
private SqlTypeDescriptor sqlTypeDescriptor;
private JavaTypeDescriptor<T> javaTypeDescriptor;
// sqlTypes need always to be in sync with sqlTypeDescriptor
private int[] sqlTypes;
public AbstractStandardBasicType(SqlTypeDescriptor sqlTypeDescriptor, JavaTypeDescriptor<T> javaTypeDescriptor) {
this.sqlTypeDescriptor = sqlTypeDescriptor;
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() };
this.javaTypeDescriptor = javaTypeDescriptor;
}
@ -142,6 +145,7 @@ public abstract class AbstractStandardBasicType<T>
public final void setSqlTypeDescriptor( SqlTypeDescriptor sqlTypeDescriptor ) {
this.sqlTypeDescriptor = sqlTypeDescriptor;
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() };
}
public final Class getReturnedClass() {
@ -153,7 +157,7 @@ public abstract class AbstractStandardBasicType<T>
}
public final int[] sqlTypes(Mapping mapping) throws MappingException {
return new int[] { sqlTypeDescriptor.getSqlType() };
return sqlTypes;
}
@Override