Skip to content

Commit bc76fcb

Browse files
schaudermp911de
authored andcommitted
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.
1 parent 1512e87 commit bc76fcb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/main/java/org/springframework/data/repository/CrudRepository.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*
2323
* @author Oliver Gierke
2424
* @author Eberhard Wolff
25+
* @author Jens Schauder
2526
*/
2627
@NoRepositoryBean
2728
public interface CrudRepository<T, ID> extends Repository<T, ID> {
@@ -117,6 +118,15 @@ public interface CrudRepository<T, ID> extends Repository<T, ID> {
117118
*/
118119
void deleteAll(Iterable<? extends T> entities);
119120

121+
/**
122+
* Deletes all instances of the type {@code T} with the given IDs.
123+
*
124+
* @param ids must not be {@literal null}. Must not contain {@literal null} elements.
125+
* @throws IllegalArgumentException in case the given {@literal ids} or one of its elements is {@literal null}.
126+
* @since 2.5
127+
*/
128+
void deleteAllById(Iterable<? extends ID> ids);
129+
120130
/**
121131
* Deletes all entities managed by the repository.
122132
*/

src/main/java/org/springframework/data/repository/reactive/ReactiveCrudRepository.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
*
2929
* @author Mark Paluch
3030
* @author Christph Strobl
31+
* @author Jens Schauder
3132
* @since 2.0
3233
* @see Mono
3334
* @see Flux
@@ -179,6 +180,17 @@ public interface ReactiveCrudRepository<T, ID> extends Repository<T, ID> {
179180
*/
180181
Mono<Void> deleteAll(Iterable<? extends T> entities);
181182

183+
/**
184+
* Deletes all instances of the type {@code T} with the given IDs.
185+
*
186+
* @param ids must not be {@literal null}.
187+
* @return {@link Mono} signaling when operation has completed.
188+
* @throws IllegalArgumentException in case the given {@literal ids} or one of its elements is {@literal null}.
189+
* {@literal null}.
190+
* @since 2.5
191+
*/
192+
Mono<Void> deleteAllById(Iterable<? extends ID> ids);
193+
182194
/**
183195
* Deletes the given entities supplied by a {@link Publisher}.
184196
*

0 commit comments

Comments
 (0)