0

I am using Spring JDBC template to insert batches to MySql DB. Since I use &rewriteBatchedStatements=true, If I have a primary key violation it will fail the entire batch.

The problem is I cannot know which record is the evil one who caused the batch to fail.

All I get is BatchUpdateException with an array of -3 statuses.

I moved to use INSERT IGNORE but I would really like to see which records failed my batch, remove it, and persist all others.

Is this possible? maybe with Hibernate 5?

Regards, Ido

Ido Barash
  • 4,856
  • 11
  • 41
  • 78
  • I wouldn't add Hibernate; it would only make your situation worse. Better to figure out how to log messages more appropriately. – duffymo Dec 03 '18 at 16:18
  • We had the same problem with db2 batches. -3 status for all items when only one item fails. – B_St Dec 04 '18 at 13:01

0 Answers0