Skip to content

Commit 89a41a7

Browse files
committed
Polishing.
Align documentation between reactive and imperative repository variants. See #3280 Original pull request: #3281
1 parent 5815c21 commit 89a41a7

File tree

3 files changed

+21
-16
lines changed

3 files changed

+21
-16
lines changed

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

+13-10
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
import org.springframework.dao.OptimisticLockingFailureException;
2121

2222
/**
23-
* Interface for generic CRUD operations on a repository for a specific type. In general operations offered via this
24-
* interface participate in life cycle events, and optimistic locking. Therefore, modules may choose to load an entity
25-
* before deleting or updating it in order to facilitate this, and any modifying method call may trigger an exception
26-
* due to failure of optimistic locking.
27-
*
23+
* Interface for generic CRUD operations on a repository for a specific type. Methods exposed through this interface
24+
* allow entities to participate in lifecycle events, and optimistic locking if applicable except for some bulk
25+
* operation methods. Therefore, modules may choose to load an entity before deleting or updating it in order to
26+
* facilitate events, and any modifying method call may trigger an exception due to failure of optimistic locking.
27+
*
2828
* @author Oliver Gierke
2929
* @author Eberhard Wolff
3030
* @author Jens Schauder
@@ -109,13 +109,12 @@ public interface CrudRepository<T, ID> extends Repository<T, ID> {
109109
* Deletes the entity with the given id.
110110
* <p>
111111
* If the entity is not found in the persistence store it is silently ignored.
112-
* <p>
113-
* Note that, since this method triggers life cycle events, it might need to load an entity before deleting it. This
114-
* also might trigger {@link OptimisticLockingFailureException} if between loading and actually deleting the entity,
115-
* the entity was changed by some other process.
116-
*
112+
*
117113
* @param id must not be {@literal null}.
118114
* @throws IllegalArgumentException in case the given {@literal id} is {@literal null}
115+
* @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with
116+
* a different value from that found in the persistence store. Also thrown if the entity is assumed to be
117+
* present but does not exist in the database.
119118
*/
120119
void deleteById(ID id);
121120

@@ -137,6 +136,9 @@ public interface CrudRepository<T, ID> extends Repository<T, ID> {
137136
*
138137
* @param ids must not be {@literal null}. Must not contain {@literal null} elements.
139138
* @throws IllegalArgumentException in case the given {@literal ids} or one of its elements is {@literal null}.
139+
* @throws OptimisticLockingFailureException when the entity uses optimistic locking and has a version attribute with
140+
* a different value from that found in the persistence store. Also thrown if the entity is assumed to be
141+
* present but does not exist in the database.
140142
* @since 2.5
141143
*/
142144
void deleteAllById(Iterable<? extends ID> ids);
@@ -156,4 +158,5 @@ public interface CrudRepository<T, ID> extends Repository<T, ID> {
156158
* Deletes all entities managed by the repository.
157159
*/
158160
void deleteAll();
161+
159162
}

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@
2626

2727
/**
2828
* Interface for generic CRUD operations on a repository for a specific type. This repository follows reactive paradigms
29-
* and uses Project Reactor types which are built on top of Reactive Streams.
29+
* and uses Project Reactor types which are built on top of Reactive Streams. Methods exposed through this interface
30+
* allow entities to participate in lifecycle events, and optimistic locking if applicable except for some bulk
31+
* operation methods. Therefore, modules may choose to load an entity before deleting or updating it in order to
32+
* facilitate events, and any modifying method call may trigger an exception due to failure of optimistic locking.
3033
* <p>
3134
* Save and delete operations with entities that have a version attribute trigger an {@code onError} with a
3235
* {@link org.springframework.dao.OptimisticLockingFailureException} when they encounter a different version value in
3336
* the persistence store than in the entity passed as an argument.
34-
* </p>
3537
* <p>
3638
* Other delete operations that only receive ids or entities without version attribute do not trigger an error when no
3739
* matching data is found in the persistence store.
38-
* </p>
3940
*
4041
* @author Mark Paluch
4142
* @author Christph Strobl

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@
2626

2727
/**
2828
* Interface for generic CRUD operations on a repository for a specific type. This repository follows reactive paradigms
29-
* and uses RxJava 3 types.
29+
* and uses RxJava 3 types. Methods exposed through this interface allow entities to participate in lifecycle events,
30+
* and optimistic locking if applicable except for some bulk operation methods. Therefore, modules may choose to load an
31+
* entity before deleting or updating it in order to facilitate events, and any modifying method call may trigger an
32+
* exception due to failure of optimistic locking.
3033
* <p>
3134
* Save and delete operations with entities that have a version attribute trigger an {@code onError} with a
3235
* {@link org.springframework.dao.OptimisticLockingFailureException} when they encounter a different version value in
3336
* the persistence store than in the entity passed as an argument.
34-
* </p>
3537
* <p>
3638
* Other delete operations that only receive ids or entities without version attribute do not trigger an error when no
3739
* matching data is found in the persistence store.
38-
* </p>
3940
*
4041
* @author Mark Paluch
4142
* @since 2.4

0 commit comments

Comments
 (0)