I am writing batch processing. I load CSV file (up to 10.000 rows) and I insert them in database. I do not want my processing to fail in case of duplicates.
Is it possible to do such INSERT
in single transaction, catch exception for duplicates, proceed with INSERT
and commit the transaction?
Or, is there no other way than transaction-per-INSERT pattern?
Currently, my transaction is always rolled back for PersistenceException
, no matter how I configure noRollbackFor attribute for my transaction (Transactional
annotation).
I use Spring Boot 1.4.2 (with Hibernate 5 and Spring Framework 4.3.5).