Skip to content

Commit

Permalink
Merge pull request #549 from jakartaee/update-update-method
Browse files Browse the repository at this point in the history
Update update method to achieve consistency between other writing methods in repository interfaces
  • Loading branch information
otaviojava authored Mar 18, 2024
2 parents 3c3165f + 8cf89b0 commit dcd6e5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/src/main/java/jakarta/data/repository/CrudRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,15 @@ public interface CrudRepository<T, K> extends BasicRepository<T, K> {
* the update.</p>
*
* @param entity the entity to update. Must not be {@code null}.
* @param <S> Type of the entity to update.
* @return an updated entity instance including all automatically generated values,
* updated versions, and incremented values which changed as a result of the update.
* @throws OptimisticLockingFailureException the entity is not found in the database
* or has a version that differs from the version in the database.
* @throws NullPointerException if the entity is null.
*/
@Update
T update(T entity);
<S extends T> S update(S entity);

/**
* <p>Modifies entities that already exist in the database.</p>
Expand All @@ -167,6 +168,7 @@ public interface CrudRepository<T, K> extends BasicRepository<T, K> {
* the update.</p>
*
* @param entities entities to update.
* @param <S> Type of the entities to update.
* @return updated entity instances, in the same order as the supplied entities,
* and including all automatically generated values, updated versions, and
* incremented values which changed as a result of the update.
Expand All @@ -175,6 +177,6 @@ public interface CrudRepository<T, K> extends BasicRepository<T, K> {
* @throws NullPointerException if either the supplied {@code Iterable} is null or any element is null.
*/
@Update
Iterable<T> updateAll(Iterable<T> entities);
<S extends T> Iterable<S> updateAll(Iterable<S> entities);

}

0 comments on commit dcd6e5a

Please sign in to comment.