I have this requirement:
- Csv Upload (using opencsv)
- Should display if the record is inserted (if it doesn't exist in the db) or updated (if it exists). Eg.: 5 records inserted 2 records updated.
Usually I use
repo.saveAll(entityObjList) to save all the entries.
Since I have to keep track of number of updates and inserts, I came up with using the
repo.save(entityObj) method inside the for loop which is not greatly appreciated.
Is there any other way to approach this problem ? Any suggestion is welcome.