Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -605,14 +605,20 @@ public int[] doInStatement(Statement stmt) throws SQLException, DataAccessExcept
rowsAffected = stmt.executeBatch();
}
catch (BatchUpdateException ex) {
String batchExceptionSql = null;
for (int i = 0; i < ex.getUpdateCounts().length; i++) {
if (ex.getUpdateCounts()[i] == Statement.EXECUTE_FAILED) {
batchExceptionSql = appendSql(batchExceptionSql, sql[i]);
int[] updateCounts = ex.getUpdateCounts();
StringBuilder batchExceptionSql = new StringBuilder();

for (int i = 0; i < Math.min(updateCounts.length, sql.length); i++) {
if (updateCounts[i] == Statement.EXECUTE_FAILED) {
if (batchExceptionSql.length() > 0) {
batchExceptionSql.append("; ");
}
batchExceptionSql.append(sql[i]);
}
}
if (StringUtils.hasLength(batchExceptionSql)) {
this.currSql = batchExceptionSql;

if (batchExceptionSql.length() > 0) {
this.currSql = batchExceptionSql.toString();
}
throw ex;
}
Expand Down