StatementCreatorUtils avoids direct calls with SQL type argument in case of Types.OTHER

Issue: SPR-8571
This commit is contained in:
Juergen Hoeller
2014-08-19 20:52:54 +02:00
parent 8c76381d95
commit 759f430ba5
2 changed files with 14 additions and 3 deletions

View File

@@ -239,7 +239,7 @@ public abstract class StatementCreatorUtils {
* respecting database-specific peculiarities.
*/
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException {
if (sqlType == SqlTypeValue.TYPE_UNKNOWN) {
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || sqlType == Types.OTHER) {
boolean useSetObject = false;
Integer sqlTypeToUse = null;
DatabaseMetaData dbmd = null;
@@ -385,7 +385,7 @@ public abstract class StatementCreatorUtils {
ps.setObject(paramIndex, inValue, Types.TIMESTAMP);
}
}
else if (sqlType == SqlTypeValue.TYPE_UNKNOWN) {
else if (sqlType == SqlTypeValue.TYPE_UNKNOWN || sqlType == Types.OTHER) {
if (isStringValue(inValue.getClass())) {
ps.setString(paramIndex, inValue.toString());
}