Avoid calling executeBatch() with an empty batch

See gh-27154
This commit is contained in:
Li0n13
2021-07-11 17:08:32 +03:00
committed by Stephane Nicoll
parent a6b0c75cae
commit 2d7bf83d8d
2 changed files with 29 additions and 1 deletions

View File

@@ -1050,7 +1050,7 @@ public class JdbcTemplate extends JdbcAccessor implements JdbcOperations {
}
ps.addBatch();
}
return ps.executeBatch();
return batchSize > 0 ? ps.executeBatch() : new int[] {};
}
else {
List<Integer> rowsAffected = new ArrayList<>();