Skip to content

Commit 30d793c

Browse files
committed
Revise deprecation of SqlQuery.rowsExpected
Closes gh-34526
1 parent 78cc5df commit 30d793c

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -63,6 +63,7 @@ public class SqlFunction<T> extends MappingSqlQuery<T> {
6363
* @see #setSql
6464
* @see #compile
6565
*/
66+
@SuppressWarnings("removal")
6667
public SqlFunction() {
6768
setRowsExpected(1);
6869
}
@@ -73,6 +74,7 @@ public SqlFunction() {
7374
* @param ds the DataSource to obtain connections from
7475
* @param sql the SQL to execute
7576
*/
77+
@SuppressWarnings("removal")
7678
public SqlFunction(DataSource ds, String sql) {
7779
setRowsExpected(1);
7880
setDataSource(ds);
@@ -87,6 +89,7 @@ public SqlFunction(DataSource ds, String sql) {
8789
* {@code java.sql.Types} class
8890
* @see java.sql.Types
8991
*/
92+
@SuppressWarnings("removal")
9093
public SqlFunction(DataSource ds, String sql, int[] types) {
9194
setRowsExpected(1);
9295
setDataSource(ds);
@@ -104,6 +107,7 @@ public SqlFunction(DataSource ds, String sql, int[] types) {
104107
* @see #setResultType(Class)
105108
* @see java.sql.Types
106109
*/
110+
@SuppressWarnings("removal")
107111
public SqlFunction(DataSource ds, String sql, int[] types, Class<T> resultType) {
108112
setRowsExpected(1);
109113
setDataSource(ds);

spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public SqlQuery(DataSource ds, String sql) {
8484
* Set the number of rows expected.
8585
* <p>This can be used to ensure efficient storage of results. The
8686
* default behavior is not to expect any specific number of rows.
87-
* @deprecated since 6.2.4 with no replacement; it's for internal use only
87+
* @deprecated since 6.2.4 with no replacement since the property has never
88+
* had any affect on behavior; to be removed in 7.0
8889
*/
8990
@Deprecated(since = "6.2.4", forRemoval = true)
9091
public void setRowsExpected(int rowsExpected) {
@@ -93,7 +94,8 @@ public void setRowsExpected(int rowsExpected) {
9394

9495
/**
9596
* Get the number of rows expected.
96-
* @deprecated since 6.2.4 with no replacement; it's for internal use only
97+
* @deprecated since 6.2.4 with no replacement since the property has never
98+
* had any affect on behavior; to be removed in 7.0
9799
*/
98100
@Deprecated(since = "6.2.4", forRemoval = true)
99101
public int getRowsExpected() {

spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 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.
@@ -163,6 +163,7 @@ protected Integer mapRow(ResultSet rs, int rownum) throws SQLException {
163163
}
164164

165165
@Test
166+
@SuppressWarnings("removal")
166167
void testStringQueryWithResults() throws Exception {
167168
String[] dbResults = new String[] { "alpha", "beta", "charlie" };
168169
given(resultSet.next()).willReturn(true, true, true, false);

0 commit comments

Comments
 (0)