#1247 - Unique index or primary key violation - when jdbc batch cascading to PrivateOwned child with unique constraint

This commit is contained in:
Rob Bygrave
2018-02-02 20:43:55 +13:00
parent 851f1c98b0
commit 5ff71324d0
2 changed files with 31 additions and 4 deletions
@@ -84,6 +84,10 @@ public class BatchedBeanHolder {
// with binding addBatch() for each request.
// Note updates and deletes can result in many PreparedStatements
// if their where clauses differ via use of IS NOT NULL.
if (deletes != null && !deletes.isEmpty()) {
control.executeNow(deletes);
deletes.clear();
}
if (inserts != null && !inserts.isEmpty()) {
control.executeNow(inserts);
inserts.clear();
@@ -92,10 +96,6 @@ public class BatchedBeanHolder {
control.executeNow(updates);
updates.clear();
}
if (deletes != null && !deletes.isEmpty()) {
control.executeNow(deletes);
deletes.clear();
}
persistedBeans.clear();
}