diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java index a7b043adff..de6df06fc3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -353,7 +353,7 @@ public interface JdbcOperations { * @throws DataAccessException if the query fails */ @Nullable - T query(String sql, Object[] args, ResultSetExtractor rse) throws DataAccessException; + T query(String sql, @Nullable Object[] args, ResultSetExtractor rse) throws DataAccessException; /** * Query given SQL to create a prepared statement from SQL and a list of arguments @@ -423,7 +423,7 @@ public interface JdbcOperations { * @param rch a callback that will extract results, one row at a time * @throws DataAccessException if the query fails */ - void query(String sql, Object[] args, RowCallbackHandler rch) throws DataAccessException; + void query(String sql, @Nullable Object[] args, RowCallbackHandler rch) throws DataAccessException; /** * Query given SQL to create a prepared statement from SQL and a list of @@ -496,7 +496,7 @@ public interface JdbcOperations { * @return the result List, containing mapped objects * @throws DataAccessException if the query fails */ - List query(String sql, Object[] args, RowMapper rowMapper) throws DataAccessException; + List query(String sql, @Nullable Object[] args, RowMapper rowMapper) throws DataAccessException; /** * Query given SQL to create a prepared statement from SQL and a list of @@ -551,7 +551,7 @@ public interface JdbcOperations { * @throws DataAccessException if the query fails */ @Nullable - T queryForObject(String sql, Object[] args, RowMapper rowMapper) throws DataAccessException; + T queryForObject(String sql, @Nullable Object[] args, RowMapper rowMapper) throws DataAccessException; /** * Query given SQL to create a prepared statement from SQL and a list @@ -612,7 +612,7 @@ public interface JdbcOperations { * @see #queryForObject(String, Class) */ @Nullable - T queryForObject(String sql, Object[] args, Class requiredType) throws DataAccessException; + T queryForObject(String sql, @Nullable Object[] args, Class requiredType) throws DataAccessException; /** * Query given SQL to create a prepared statement from SQL and a list of @@ -713,7 +713,7 @@ public interface JdbcOperations { * @see #queryForList(String, Class) * @see SingleColumnRowMapper */ - List queryForList(String sql, Object[] args, Class elementType) throws DataAccessException; + List queryForList(String sql, @Nullable Object[] args, Class elementType) throws DataAccessException; /** * Query given SQL to create a prepared statement from SQL and a list of diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java index 0f4a8483cb..0ffb9bbbc3 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -734,7 +734,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { } @Override - public void query(String sql, Object[] args, RowCallbackHandler rch) throws DataAccessException { + public void query(String sql, @Nullable Object[] args, RowCallbackHandler rch) throws DataAccessException { query(sql, newArgPreparedStatementSetter(args), rch); } @@ -800,7 +800,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { } @Override - public T queryForObject(String sql, Object[] args, Class requiredType) throws DataAccessException { + public T queryForObject(String sql, @Nullable Object[] args, Class requiredType) throws DataAccessException { return queryForObject(sql, args, getSingleColumnRowMapper(requiredType)); } @@ -825,7 +825,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations { } @Override - public List queryForList(String sql, Object[] args, Class elementType) throws DataAccessException { + public List queryForList(String sql, @Nullable Object[] args, Class elementType) throws DataAccessException { return query(sql, args, getSingleColumnRowMapper(elementType)); }