Remove pre-3.2 deprecated classes and methods

Issue: SPR-12578
This commit is contained in:
Juergen Hoeller
2014-12-30 20:05:15 +01:00
parent fad76336f6
commit 9ac02b319d
34 changed files with 77 additions and 1649 deletions

View File

@@ -183,44 +183,6 @@ public interface JdbcOperations {
*/
Map<String, Object> queryForMap(String sql) throws DataAccessException;
/**
* Execute a query that results in a long value, given static SQL.
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
* execute a static query with a PreparedStatement, use the overloaded
* {@code queryForLong} method with {@code null} as argument array.
* <p>This method is useful for running static SQL with a known outcome.
* The query is expected to be a single row/single column query that results
* in a long value.
* @param sql SQL query to execute
* @return the long value, or 0 in case of SQL NULL
* @throws IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws DataAccessException if there is any problem executing the query
* @see #queryForLong(String, Object[])
* @deprecated in favor of {@link #queryForObject(String, Class)}
*/
@Deprecated
long queryForLong(String sql) throws DataAccessException;
/**
* Execute a query that results in an int value, given static SQL.
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
* execute a static query with a PreparedStatement, use the overloaded
* {@code queryForInt} method with {@code null} as argument array.
* <p>This method is useful for running static SQL with a known outcome.
* The query is expected to be a single row/single column query that results
* in an int value.
* @param sql SQL query to execute
* @return the int value, or 0 in case of SQL NULL
* @throws IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws DataAccessException if there is any problem executing the query
* @see #queryForInt(String, Object[])
* @deprecated in favor of {@link #queryForObject(String, Class)}
*/
@Deprecated
int queryForInt(String sql) throws DataAccessException;
/**
* Execute a query for a result list, given static SQL.
* <p>Uses a JDBC Statement, not a PreparedStatement. If you want to
@@ -695,86 +657,6 @@ public interface JdbcOperations {
*/
Map<String, Object> queryForMap(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in a long value.
* <p>The query is expected to be a single row/single column query that
* results in a long value.
* @param sql SQL query to execute
* @param args arguments to bind to the query
* @param argTypes SQL types of the arguments
* (constants from {@code java.sql.Types})
* @return the long value, or 0 in case of SQL NULL
* @throws IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws DataAccessException if the query fails
* @see #queryForLong(String)
* @see java.sql.Types
* @deprecated in favor of {@link #queryForObject(String, Object[], int[], Class)} )}
*/
@Deprecated
long queryForLong(String sql, Object[] args, int[] argTypes) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in a long value.
* <p>The query is expected to be a single row/single column query that
* results in a long value.
* @param sql SQL query to execute
* @param args arguments to bind to the query
* (leaving it to the PreparedStatement to guess the corresponding SQL type);
* may also contain {@link SqlParameterValue} objects which indicate not
* only the argument value but also the SQL type and optionally the scale
* @return the long value, or 0 in case of SQL NULL
* @throws IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws DataAccessException if the query fails
* @see #queryForLong(String)
* @deprecated in favor of {@link #queryForObject(String, Class, Object[])} )}
*/
@Deprecated
long queryForLong(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in an int value.
* <p>The query is expected to be a single row/single column query that
* results in an int value.
* @param sql SQL query to execute
* @param args arguments to bind to the query
* @param argTypes SQL types of the arguments
* (constants from {@code java.sql.Types})
* @return the int value, or 0 in case of SQL NULL
* @throws IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws DataAccessException if the query fails
* @see #queryForInt(String)
* @see java.sql.Types
* @deprecated in favor of {@link #queryForObject(String, Object[], int[], Class)} )}
*/
@Deprecated
int queryForInt(String sql, Object[] args, int[] argTypes) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in an int value.
* <p>The query is expected to be a single row/single column query that
* results in an int value.
* @param sql SQL query to execute
* @param args arguments to bind to the query
* (leaving it to the PreparedStatement to guess the corresponding SQL type);
* may also contain {@link SqlParameterValue} objects which indicate not
* only the argument value but also the SQL type and optionally the scale
* @return the int value, or 0 in case of SQL NULL
* @throws IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws DataAccessException if the query fails
* @see #queryForInt(String)
* @deprecated in favor of {@link #queryForObject(String, Class, Object[])} )}
*/
@Deprecated
int queryForInt(String sql, Object... args) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, expecting a result list.

View File

@@ -497,20 +497,6 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return queryForObject(sql, getSingleColumnRowMapper(requiredType));
}
@Override
@Deprecated
public long queryForLong(String sql) throws DataAccessException {
Number number = queryForObject(sql, Long.class);
return (number != null ? number.longValue() : 0);
}
@Override
@Deprecated
public int queryForInt(String sql) throws DataAccessException {
Number number = queryForObject(sql, Integer.class);
return (number != null ? number.intValue() : 0);
}
@Override
public <T> List<T> queryForList(String sql, Class<T> elementType) throws DataAccessException {
return query(sql, getSingleColumnRowMapper(elementType));
@@ -839,34 +825,6 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
return queryForObject(sql, args, getColumnMapRowMapper());
}
@Override
@Deprecated
public long queryForLong(String sql, Object[] args, int[] argTypes) throws DataAccessException {
Number number = queryForObject(sql, args, argTypes, Long.class);
return (number != null ? number.longValue() : 0);
}
@Override
@Deprecated
public long queryForLong(String sql, Object... args) throws DataAccessException {
Number number = queryForObject(sql, args, Long.class);
return (number != null ? number.longValue() : 0);
}
@Override
@Deprecated
public int queryForInt(String sql, Object[] args, int[] argTypes) throws DataAccessException {
Number number = queryForObject(sql, args, argTypes, Integer.class);
return (number != null ? number.intValue() : 0);
}
@Override
@Deprecated
public int queryForInt(String sql, Object... args) throws DataAccessException {
Number number = queryForObject(sql, args, Integer.class);
return (number != null ? number.intValue() : 0);
}
@Override
public <T> List<T> queryForList(String sql, Object[] args, int[] argTypes, Class<T> elementType) throws DataAccessException {
return query(sql, args, argTypes, getSingleColumnRowMapper(elementType));

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2013 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -325,78 +325,6 @@ public interface NamedParameterJdbcOperations {
*/
Map<String, Object> queryForMap(String sql, Map<String, ?> paramMap) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in a long value.
* <p>The query is expected to be a single row/single column query that
* results in a long value.
* @param sql SQL query to execute
* @param paramSource container of arguments to bind to the query
* @return the long value, or 0 in case of SQL NULL
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException
* if the query does not return exactly one row, or does not return exactly
* one column in that row
* @throws org.springframework.dao.DataAccessException if the query fails
* @see org.springframework.jdbc.core.JdbcTemplate#queryForLong(String)
* @deprecated in favor of {@link #queryForObject(String, SqlParameterSource, Class)}
*/
@Deprecated
long queryForLong(String sql, SqlParameterSource paramSource) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in a long value.
* <p>The query is expected to be a single row/single column query that
* results in a long value.
* @param sql SQL query to execute
* @param paramMap map of parameters to bind to the query
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
* @return the long value, or 0 in case of SQL NULL
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException
* if the query does not return exactly one row, or does not return exactly
* one column in that row
* @throws org.springframework.dao.DataAccessException if the query fails
* @see org.springframework.jdbc.core.JdbcTemplate#queryForLong(String)
* @deprecated in favor of {@link #queryForObject(String, Map, Class)}
*/
@Deprecated
long queryForLong(String sql, Map<String, ?> paramMap) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in an int value.
* <p>The query is expected to be a single row/single column query that
* results in an int value.
* @param sql SQL query to execute
* @param paramSource container of arguments to bind to the query
* @return the int value, or 0 in case of SQL NULL
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws org.springframework.dao.DataAccessException if the query fails
* @see org.springframework.jdbc.core.JdbcTemplate#queryForInt(String)
* @deprecated in favor of {@link #queryForObject(String, SqlParameterSource, Class)}
*/
@Deprecated
int queryForInt(String sql, SqlParameterSource paramSource) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, resulting in an int value.
* <p>The query is expected to be a single row/single column query that
* results in an int value.
* @param sql SQL query to execute
* @param paramMap map of parameters to bind to the query
* (leaving it to the PreparedStatement to guess the corresponding SQL type)
* @return the int value, or 0 in case of SQL NULL
* @throws org.springframework.dao.IncorrectResultSizeDataAccessException if the query does not return
* exactly one row, or does not return exactly one column in that row
* @throws org.springframework.dao.DataAccessException if the query fails
* @see org.springframework.jdbc.core.JdbcTemplate#queryForInt(String)
* @deprecated in favor of {@link #queryForObject(String, Map, Class)}
*/
@Deprecated
int queryForInt(String sql, Map<String, ?> paramMap) throws DataAccessException;
/**
* Query given SQL to create a prepared statement from SQL and a
* list of arguments to bind to the query, expecting a result list.

View File

@@ -243,32 +243,6 @@ public class NamedParameterJdbcTemplate implements NamedParameterJdbcOperations
return queryForObject(sql, paramMap, new ColumnMapRowMapper());
}
@Override
@Deprecated
public long queryForLong(String sql, SqlParameterSource paramSource) throws DataAccessException {
Number number = queryForObject(sql, paramSource, Long.class);
return (number != null ? number.longValue() : 0);
}
@Override
@Deprecated
public long queryForLong(String sql, Map<String, ?> paramMap) throws DataAccessException {
return queryForLong(sql, new MapSqlParameterSource(paramMap));
}
@Override
@Deprecated
public int queryForInt(String sql, SqlParameterSource paramSource) throws DataAccessException {
Number number = queryForObject(sql, paramSource, Integer.class);
return (number != null ? number.intValue() : 0);
}
@Override
@Deprecated
public int queryForInt(String sql, Map<String, ?> paramMap) throws DataAccessException {
return queryForInt(sql, new MapSqlParameterSource(paramMap));
}
@Override
public <T> List<T> queryForList(String sql, SqlParameterSource paramSource, Class<T> elementType)
throws DataAccessException {