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

Issue: SPR-16669
This commit is contained in:
Juergen Hoeller 2018-03-29 23:43:53 +02:00
parent 93abe0e94b
commit 9a722b4558
1 changed files with 2 additions and 2 deletions

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -240,7 +240,7 @@ public abstract class StatementCreatorUtils {
private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, @Nullable String typeName) private static void setNull(PreparedStatement ps, int paramIndex, int sqlType, @Nullable String typeName)
throws SQLException { throws SQLException {
if (sqlType == SqlTypeValue.TYPE_UNKNOWN || sqlType == Types.OTHER) { if (sqlType == SqlTypeValue.TYPE_UNKNOWN || (sqlType == Types.OTHER && typeName == null)) {
boolean useSetObject = false; boolean useSetObject = false;
Integer sqlTypeToUse = null; Integer sqlTypeToUse = null;
if (!shouldIgnoreGetParameterType) { if (!shouldIgnoreGetParameterType) {