mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
Make batchArgs contents nullable in batchUpdate
Updated batchUpdate method signatures to allow nullable Object arrays. See gh-37012 Signed-off-by: Chris <christian@vonrueti.ch>
This commit is contained in:
@@ -1046,12 +1046,12 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] batchUpdate(String sql, List<Object[]> batchArgs) throws DataAccessException {
|
||||
public int[] batchUpdate(String sql, List<@Nullable Object[]> batchArgs) throws DataAccessException {
|
||||
return batchUpdate(sql, batchArgs, new int[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] batchUpdate(String sql, List<Object[]> batchArgs, int[] argTypes) throws DataAccessException {
|
||||
public int[] batchUpdate(String sql, List<@Nullable Object[]> batchArgs, int[] argTypes) throws DataAccessException {
|
||||
if (batchArgs.isEmpty()) {
|
||||
return new int[0];
|
||||
}
|
||||
@@ -1061,9 +1061,9 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
|
||||
new BatchPreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps, int i) throws SQLException {
|
||||
Object[] values = batchArgs.get(i);
|
||||
@Nullable Object[] values = batchArgs.get(i);
|
||||
int colIndex = 0;
|
||||
for (Object value : values) {
|
||||
for (@Nullable Object value : values) {
|
||||
colIndex++;
|
||||
if (value instanceof SqlParameterValue paramValue) {
|
||||
StatementCreatorUtils.setParameterValue(ps, colIndex, paramValue, paramValue.getValue());
|
||||
|
||||
Reference in New Issue
Block a user