Added deleteInBatch method to JpaRepository.
Reverted implementation of delete(Iterable<T> entities) to iterate over the entities as creating a query can cause the persistence provider to choke on really large entity sets. Beyond that triggering a query would require us to clear the persistence context which might not be wanted in every case. Thus an additional method deleteInBatch(Iterable<T> entities) especially available on the JpaRepository interface now triggers the query but clearly states the assumptions and side effects in the JavaDoc. Removed some obsolete finals and an obsolete method.
This commit is contained in:
@@ -225,6 +225,18 @@ public class UserRepositoryTests {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void batchDeleteColletionOfEntities() {
|
||||
|
||||
flushTestUsers();
|
||||
|
||||
long before = repository.count();
|
||||
|
||||
repository.deleteInBatch(Arrays.asList(firstUser, secondUser));
|
||||
assertThat(repository.count(), is(before - 2));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void deleteEmptyCollectionDoesNotDeleteAnything() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user