HHH-15441 Improve error message if SqlTypes type code can't be interpreted
This commit is contained in:
parent
a681c0e1d9
commit
95a300d7d9
|
@ -9,6 +9,7 @@ package org.hibernate.internal.util.config;
|
|||
import java.sql.Types;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.StringTokenizer;
|
||||
|
@ -600,12 +601,17 @@ public final class ConfigurationHelper {
|
|||
return ( (Number) value ).intValue();
|
||||
}
|
||||
|
||||
final String string = value.toString();
|
||||
final String string = value.toString().toUpperCase( Locale.ROOT );
|
||||
final Integer typeCode = JdbcTypeNameMapper.getTypeCode( string );
|
||||
if ( typeCode != null ) {
|
||||
return typeCode;
|
||||
}
|
||||
try {
|
||||
return Integer.parseInt( string );
|
||||
}
|
||||
catch (NumberFormatException ex) {
|
||||
throw new IllegalArgumentException( String.format( "Couldn't interpret '%s' as JDBC type code or type code name", string ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue