i have a repository used in the writer of a spring-batch, it’s a simpleJpaRepository, and for the sake of performances, i use saveAll() to save a list of entities. during the save, sometimes the repository throws an exception due to duplicate entities (i have a unicity contstraint in my table, the repository tries to insert a new entity with null id, but fails due to an already existing entity with the same unicity columns). the result is a batch failure.
i would like to find an elegant way to tell the repository “if you find a duplicate, ignore the insert, and move to next entity”.
i would like to avoid having to iterate over the list and check for each entity if it exists or not.