Browse Source

Pass type name into PreparedStatement.setNull in case of Types.OTHER

Issue: SPR-16669

(cherry picked from commit 9a722b4)
pull/1775/head
Juergen Hoeller 8 years ago
parent
commit
5629fa2c9f
  1. 4
      spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java

4
spring-jdbc/src/main/java/org/springframework/jdbc/core/StatementCreatorUtils.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -247,7 +247,7 @@ public abstract class StatementCreatorUtils { @@ -247,7 +247,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 || sqlType == Types.OTHER) {
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || (sqlType == Types.OTHER && typeName == null)) {
boolean useSetObject = false;
Integer sqlTypeToUse = null;
DatabaseMetaData dbmd = null;

Loading…
Cancel
Save