Skip to content

Commit 5629fa2

Browse files
committed
Pass type name into PreparedStatement.setNull in case of Types.OTHER
Issue: SPR-16669 (cherry picked from commit 9a722b4)
1 parent 2903cb7 commit 5629fa2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -247,7 +247,7 @@ private static void setParameterValueInternal(PreparedStatement ps, int paramInd
247247
* respecting database-specific peculiarities.
248248
*/
249249
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, String typeName) throws SQLException {
250-
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || sqlType == Types.OTHER) {
250+
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || (sqlType == Types.OTHER && typeName == null)) {
251251
boolean useSetObject = false;
252252
Integer sqlTypeToUse = null;
253253
DatabaseMetaData dbmd = null;

0 commit comments

Comments
 (0)