diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java index 43f388be44..97bc6df719 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlFunction.java @@ -64,9 +64,7 @@ public class SqlFunction extends MappingSqlQuery { * @see #setSql * @see #compile */ - @SuppressWarnings("removal") public SqlFunction() { - setRowsExpected(1); } /** @@ -75,9 +73,7 @@ public class SqlFunction extends MappingSqlQuery { * @param ds the DataSource to obtain connections from * @param sql the SQL to execute */ - @SuppressWarnings("removal") public SqlFunction(DataSource ds, String sql) { - setRowsExpected(1); setDataSource(ds); setSql(sql); } @@ -90,9 +86,7 @@ public class SqlFunction extends MappingSqlQuery { * {@code java.sql.Types} class * @see java.sql.Types */ - @SuppressWarnings("removal") public SqlFunction(DataSource ds, String sql, int[] types) { - setRowsExpected(1); setDataSource(ds); setSql(sql); setTypes(types); @@ -108,9 +102,7 @@ public class SqlFunction extends MappingSqlQuery { * @see #setResultType(Class) * @see java.sql.Types */ - @SuppressWarnings("removal") public SqlFunction(DataSource ds, String sql, int[] types, Class resultType) { - setRowsExpected(1); setDataSource(ds); setSql(sql); setTypes(types); diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java index 39ded59e1e..5eb6fc79b2 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/object/SqlQuery.java @@ -57,10 +57,6 @@ import org.springframework.jdbc.core.namedparam.ParsedSql; */ public abstract class SqlQuery extends SqlOperation { - /** The number of rows to expect; if 0, unknown. */ - private int rowsExpected = 0; - - /** * Constructor to allow use as a JavaBean. *

The {@code DataSource} and SQL must be supplied before @@ -81,29 +77,6 @@ public abstract class SqlQuery extends SqlOperation { } - /** - * Set the number of rows expected. - *

This can be used to ensure efficient storage of results. The - * default behavior is not to expect any specific number of rows. - * @deprecated since 6.2.4 with no replacement since the property has never - * had any affect on behavior; to be removed in 7.0 - */ - @Deprecated(since = "6.2.4", forRemoval = true) - public void setRowsExpected(int rowsExpected) { - this.rowsExpected = rowsExpected; - } - - /** - * Get the number of rows expected. - * @deprecated since 6.2.4 with no replacement since the property has never - * had any affect on behavior; to be removed in 7.0 - */ - @Deprecated(since = "6.2.4", forRemoval = true) - public int getRowsExpected() { - return this.rowsExpected; - } - - /** * Central execution method. All un-named parameter execution goes through this method. * @param params parameters, similar to JDO query parameters. diff --git a/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java b/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java index 7de8434283..ce1e0fcc51 100644 --- a/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java +++ b/spring-jdbc/src/test/java/org/springframework/jdbc/object/SqlQueryTests.java @@ -55,7 +55,6 @@ import static org.mockito.Mockito.verify; */ class SqlQueryTests { - // FIXME inline? private static final String SELECT_ID = "select id from custmr"; private static final String SELECT_ID_WHERE = @@ -163,13 +162,11 @@ class SqlQueryTests { } @Test - @SuppressWarnings("removal") void testStringQueryWithResults() throws Exception { String[] dbResults = new String[] { "alpha", "beta", "charlie" }; given(resultSet.next()).willReturn(true, true, true, false); given(resultSet.getString(1)).willReturn(dbResults[0], dbResults[1], dbResults[2]); StringQuery query = new StringQuery(dataSource, SELECT_FORENAME); - query.setRowsExpected(3); String[] results = query.run(); assertThat(results).isEqualTo(dbResults); verify(connection).prepareStatement(SELECT_FORENAME);