From be136d79eec43125f21cfae650d4874829bb4a35 Mon Sep 17 00:00:00 2001 From: Yanming Zhou Date: Wed, 6 Mar 2024 10:30:33 +0800 Subject: [PATCH] Improve Javadoc for NamedParameterUtils.substituteNamedParameters() This commit documents that an empty list is not guaranteed to be supported by the database. For example, MySQL and PostgreSQL do not support `foo in ()`. See gh-32380 --- .../jdbc/core/namedparam/NamedParameterUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java index ad74063dabe..aee35e52fcf 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/NamedParameterUtils.java @@ -274,8 +274,8 @@ public abstract class NamedParameterUtils { * like:

* {@code select id, name, state from table where (name, age) in (('John', 35), ('Ann', 50))} *

The parameter values passed in are used to determine the number of placeholders to - * be used for a select list. Select lists should be limited to 100 or fewer elements. - * A larger number of elements is not guaranteed to be supported by the database and + * be used for a select list. Select lists should be limited to 100 or fewer elements and not be empty, + * A larger number of or empty elements is not guaranteed to be supported by the database and * is strictly vendor-dependent. * @param parsedSql the parsed representation of the SQL statement * @param paramSource the source for named parameters