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 6ccde14d24
commit 8cd013bf11
1 changed files with 6 additions and 2 deletions

View File

@ -64,9 +64,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;
}
@ -141,9 +144,10 @@ public abstract class AbstractStandardBasicType<T>
public final SqlTypeDescriptor getSqlTypeDescriptor() {
return sqlTypeDescriptor;
}
public final void setSqlTypeDescriptor( SqlTypeDescriptor sqlTypeDescriptor ) {
this.sqlTypeDescriptor = sqlTypeDescriptor;
this.sqlTypes = new int[] { sqlTypeDescriptor.getSqlType() };
}
public final Class getReturnedClass() {
@ -155,7 +159,7 @@ public abstract class AbstractStandardBasicType<T>
}
public final int[] sqlTypes(Mapping mapping) throws MappingException {
return new int[] { sqlTypeDescriptor.getSqlType() };
return sqlTypes;
}
@Override