DATAJDBC-629 - Implements CrudRepository.deleteAllById(Iterable<ID>).
Original pull request: #252.
This commit is contained in:
committed by
Mark Paluch
parent
636a81a46d
commit
c0d337d715
@@ -155,6 +155,11 @@ public class SimpleJdbcRepository<T, ID> implements PagingAndSortingRepository<T
|
||||
entityOperations.deleteAll(entity.getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllById(Iterable<? extends ID> ids) {
|
||||
ids.forEach(it -> entityOperations.deleteById(it, entity.getType()));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.repository.PagingAndSortingRepository#findAll(org.springframework.data.domain.Sort sort)
|
||||
@@ -172,4 +177,5 @@ public class SimpleJdbcRepository<T, ID> implements PagingAndSortingRepository<T
|
||||
public Page<T> findAll(Pageable pageable) {
|
||||
return entityOperations.findAll(entity.getType(), pageable);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -204,6 +204,20 @@ public class JdbcRepositoryIntegrationTests {
|
||||
.containsExactlyInAnyOrder(two.getIdProp());
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-629
|
||||
public void deleteByIdList() {
|
||||
|
||||
DummyEntity one = repository.save(createDummyEntity());
|
||||
DummyEntity two = repository.save(createDummyEntity());
|
||||
DummyEntity three = repository.save(createDummyEntity());
|
||||
|
||||
repository.deleteAllById(asList(one.idProp, three.idProp));
|
||||
|
||||
assertThat(repository.findAll()) //
|
||||
.extracting(DummyEntity::getIdProp) //
|
||||
.containsExactlyInAnyOrder(two.getIdProp());
|
||||
}
|
||||
|
||||
@Test // DATAJDBC-97
|
||||
public void deleteAll() {
|
||||
|
||||
|
||||
@@ -228,5 +228,10 @@ public class EnableJdbcRepositoriesIntegrationTests {
|
||||
public void deleteAll() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllById(Iterable<? extends ID> ids) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user