HHH-2304 Wrong type detection for sql type char(x) columns

This commit is contained in:
Strong Liu 2011-10-26 23:12:22 +08:00
parent 27e9957f9e
commit c26030a27e

View File

@ -633,10 +633,14 @@ public Type getHibernateType(int columnPos) throws SQLException {
int columnType = resultSetMetaData.getColumnType( columnPos ); int columnType = resultSetMetaData.getColumnType( columnPos );
int scale = resultSetMetaData.getScale( columnPos ); int scale = resultSetMetaData.getScale( columnPos );
int precision = resultSetMetaData.getPrecision( columnPos ); int precision = resultSetMetaData.getPrecision( columnPos );
int length = precision;
if ( columnType == 1 && precision == 0 ) {
length = resultSetMetaData.getColumnDisplaySize( columnPos );
}
return factory.getTypeResolver().heuristicType( return factory.getTypeResolver().heuristicType(
factory.getDialect().getHibernateTypeName( factory.getDialect().getHibernateTypeName(
columnType, columnType,
precision, length,
precision, precision,
scale scale
) )