diff --git a/src/main/java/org/springframework/data/repository/CrudRepository.java b/src/main/java/org/springframework/data/repository/CrudRepository.java index feeb07f7b..28a30a2d4 100644 --- a/src/main/java/org/springframework/data/repository/CrudRepository.java +++ b/src/main/java/org/springframework/data/repository/CrudRepository.java @@ -22,6 +22,7 @@ import java.util.Optional; * * @author Oliver Gierke * @author Eberhard Wolff + * @author Jens Schauder */ @NoRepositoryBean public interface CrudRepository extends Repository { @@ -117,6 +118,15 @@ public interface CrudRepository extends Repository { */ void deleteAll(Iterable 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 ids); + /** * Deletes all entities managed by the repository. */ diff --git a/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java b/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java index 022084b99..77d929418 100644 --- a/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java +++ b/src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java @@ -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 extends Repository { */ Mono deleteAll(Iterable 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 deleteAllById(Iterable ids); + /** * Deletes the given entities supplied by a {@link Publisher}. *