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
1 changed files with 5 additions and 1 deletions

View File

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