2020import io .reactivex .rxjava3 .core .Maybe ;
2121import io .reactivex .rxjava3 .core .Single ;
2222
23+ import org .springframework .dao .OptimisticLockingFailureException ;
2324import org .springframework .data .repository .NoRepositoryBean ;
2425import org .springframework .data .repository .Repository ;
2526
2627/**
2728 * Interface for generic CRUD operations on a repository for a specific type. This repository follows reactive paradigms
2829 * and uses RxJava 3 types.
2930 * <p>
30- * Save and delete operations with entities that have a version attribute trigger an {@code onError} with a {@link org.springframework.dao.OptimisticLockingFailureException} when they encounter a different version value in the persistence store than in the entity passed as an argument.
31+ * Save and delete operations with entities that have a version attribute trigger an {@code onError} with a
32+ * {@link org.springframework.dao.OptimisticLockingFailureException} when they encounter a different version value in
33+ * the persistence store than in the entity passed as an argument.
3134 * </p>
3235 * <p>
33- * Other delete operations that only receive ids or entities without version attribute do not trigger an error when no matching data is found in the persistence store.
36+ * Other delete operations that only receive ids or entities without version attribute do not trigger an error when no
37+ * matching data is found in the persistence store.
3438 * </p>
3539 *
3640 * @author Mark Paluch
@@ -50,6 +54,9 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
5054 * @param entity must not be {@literal null}.
5155 * @return {@link Single} emitting the saved entity.
5256 * @throws IllegalArgumentException in case the given {@literal entity} is {@literal null}.
57+ * @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with
58+ * a different value from that found in the persistence store. Also thrown if the entity is assumed to be
59+ * present but does not exist in the database.
5360 */
5461 <S extends T > Single <S > save (S entity );
5562
@@ -60,6 +67,9 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
6067 * @return {@link Flowable} emitting the saved entities.
6168 * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is
6269 * {@literal null}.
70+ * @throws OptimisticLockingFailureException when at least one entity uses optimistic locking and has a version
71+ * attribute with a different value from that found in the persistence store. Also thrown if at least one
72+ * entity is assumed to be present but does not exist in the database.
6373 */
6474 <S extends T > Flowable <S > saveAll (Iterable <S > entities );
6575
@@ -69,6 +79,9 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
6979 * @param entityStream must not be {@literal null}.
7080 * @return {@link Flowable} emitting the saved entities.
7181 * @throws IllegalArgumentException in case the given {@link Flowable entityStream} is {@literal null}.
82+ * @throws OptimisticLockingFailureException when at least one entity uses optimistic locking and has a version
83+ * attribute with a different value from that found in the persistence store. Also thrown if at least one
84+ * entity is assumed to be present but does not exist in the database.
7285 */
7386 <S extends T > Flowable <S > saveAll (Flowable <S > entityStream );
7487
@@ -151,6 +164,8 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
151164
152165 /**
153166 * Deletes the entity with the given id.
167+ * <p>
168+ * If the entity is not found in the persistence store it is silently ignored.
154169 *
155170 * @param id must not be {@literal null}.
156171 * @return {@link Completable} signaling when operation has completed.
@@ -164,11 +179,16 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
164179 * @param entity must not be {@literal null}.
165180 * @return {@link Completable} signaling when operation has completed.
166181 * @throws IllegalArgumentException in case the given entity is {@literal null}.
182+ * @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with
183+ * a different value from that found in the persistence store. Also thrown if the entity is assumed to be
184+ * present but does not exist in the database.
167185 */
168186 Completable delete (T entity );
169187
170188 /**
171189 * Deletes all instances of the type {@code T} with the given IDs.
190+ * <p>
191+ * Entities that aren't found in the persistence store are silently ignored.
172192 *
173193 * @param ids must not be {@literal null}.
174194 * @return {@link Completable} signaling when operation has completed.
@@ -185,6 +205,9 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
185205 * @return {@link Completable} signaling when operation has completed.
186206 * @throws IllegalArgumentException in case the given {@link Iterable entities} or one of its entities is
187207 * {@literal null}.
208+ * @throws OptimisticLockingFailureException when at least one entity uses optimistic locking and has a version
209+ * attribute with a different value from that found in the persistence store. Also thrown if at least one
210+ * entity is assumed to be present but does not exist in the database.
188211 */
189212 Completable deleteAll (Iterable <? extends T > entities );
190213
@@ -194,6 +217,9 @@ public interface RxJava3CrudRepository<T, ID> extends Repository<T, ID> {
194217 * @param entityStream must not be {@literal null}.
195218 * @return {@link Completable} signaling when operation has completed.
196219 * @throws IllegalArgumentException in case the given {@link Flowable entityStream} is {@literal null}.
220+ * @throws OptimisticLockingFailureException when at least one entity uses optimistic locking and has a version
221+ * attribute with a different value from that found in the persistence store. Also thrown if at least one
222+ * entity is assumed to be present but does not exist in the database.
197223 */
198224 Completable deleteAll (Flowable <? extends T > entityStream );
199225
0 commit comments