DATACMNS-800 - Adds deleteAllById to ReactiveCrudRepository and CrudRepository.

CrudRepository and ReactiveCrudRepository now expose a deleteAllById(Iterable<ID>) method to delete multiple entities by their Id.

Original pull request: #476.
This commit is contained in:
Jens Schauder
2020-10-28 14:45:38 +01:00
committed by Mark Paluch
parent 1512e878c4
commit bc76fcb7fc
2 changed files with 22 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ import java.util.Optional;
*
* @author Oliver Gierke
* @author Eberhard Wolff
* @author Jens Schauder
*/
@NoRepositoryBean
public interface CrudRepository<T, ID> extends Repository<T, ID> {
@@ -117,6 +118,15 @@ public interface CrudRepository<T, ID> extends Repository<T, ID> {
*/
void deleteAll(Iterable<? extends T> entities);
/**
* Deletes all instances of the type {@code T} with the given IDs.
*
* @param ids must not be {@literal null}. Must not contain {@literal null} elements.
* @throws IllegalArgumentException in case the given {@literal ids} or one of its elements is {@literal null}.
* @since 2.5
*/
void deleteAllById(Iterable<? extends ID> ids);
/**
* Deletes all entities managed by the repository.
*/

View File

@@ -28,6 +28,7 @@ import org.springframework.data.repository.Repository;
*
* @author Mark Paluch
* @author Christph Strobl
* @author Jens Schauder
* @since 2.0
* @see Mono
* @see Flux
@@ -179,6 +180,17 @@ public interface ReactiveCrudRepository<T, ID> extends Repository<T, ID> {
*/
Mono<Void> deleteAll(Iterable<? extends T> entities);
/**
* Deletes all instances of the type {@code T} with the given IDs.
*
* @param ids must not be {@literal null}.
* @return {@link Mono} signaling when operation has completed.
* @throws IllegalArgumentException in case the given {@literal ids} or one of its elements is {@literal null}.
* {@literal null}.
* @since 2.5
*/
Mono<Void> deleteAllById(Iterable<? extends ID> ids);
/**
* Deletes the given entities supplied by a {@link Publisher}.
*