Skip to content

Commit 9a722b4

Browse files
committed
Pass type name into PreparedStatement.setNull in case of Types.OTHER
Issue: SPR-16669
1 parent 93abe0e commit 9a722b4

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

Lines changed: 2 additions & 2 deletions
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.
@@ -240,7 +240,7 @@ private static void setParameterValueInternal(PreparedStatement ps, int paramInd
240240
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, @Nullable String typeName)
241241
throws SQLException {
242242

243-
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || sqlType == Types.OTHER) {
243+
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || (sqlType == Types.OTHER && typeName == null)) {
244244
boolean useSetObject = false;
245245
Integer sqlTypeToUse = null;
246246
if (!shouldIgnoreGetParameterType) {

0 commit comments

Comments
 (0)