Skip to content

Commit

Permalink
Code review comment from Otavio requiring insert and update to be rem…
Browse files Browse the repository at this point in the history
…oved from CrudRepository
  • Loading branch information
njr-11 committed Sep 21, 2023
1 parent 94c74b8 commit c9b5f89
Showing 1 changed file with 0 additions and 67 deletions.
67 changes: 0 additions & 67 deletions api/src/main/java/jakarta/data/repository/CrudRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
*/
package jakarta.data.repository;

import jakarta.data.exceptions.EntityExistsException;
import jakarta.data.exceptions.OptimisticLockingFailureException;
import java.util.Optional;
import java.util.stream.Stream;
Expand Down Expand Up @@ -84,72 +83,6 @@ public interface CrudRepository<T, K> extends DataRepository<T, K> {
*/
<S extends T> Iterable<S> saveAll(Iterable<S> entities);

/**
* <p>Inserts an entity into the database. If an entity of this type with the same
* unique identifier already exists in the database, then this method raises
* {@link EntityExistsException}.</p>
*
* @param entity the entity to insert. Must not be {@code null}.
* @throws EntityExistsException if the entity is already present in the database.
* @throws NullPointerException if the entity is null.
* @throws UnsupportedOperationException for Key-Value and Wide-Column databases
* that use an append model to write data.
*/
void insert(T entity);

/**
* <p>Inserts multiple entities into the database. If an entity of this type with the same
* unique identifier as any of the given entities already exists in the database,
* then this method raises {@link EntityExistsException}.</p>
*
* @param entities entities to insert.
* @throws EntityExistsException if any of the entities are already present in the database.
* @throws NullPointerException if either the iterable is null or any element is null.
* @throws UnsupportedOperationException for Key-Value and Wide-Column databases
* that use an append model to write data.
*/
void insertAll(Iterable<T> entities);

/**
* <p>Modifies an entity that already exists in the database.</p>
*
* <p>For an update to be made, a matching entity with the same unique identifier
* must be present in the database.</p>
*
* <p>If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
* another convention from the entity model such as having an attribute named {@code version}),
* then the version must also match. The version is automatically incremented when making
* the update if any of the attributes of the entity are updated in the database.</p>
*
* <p>Non-matching entities are ignored and do not cause an error to be raised.</p>
*
* @param entity the entity to update.
* @return true if a matching entity was found in the database and at least one of the
* entity's attributes is updated because of this method, otherwise false.
* @throws NullPointerException if the entity is null.
*/
boolean update(T entity);

/**
* <p>Modifies entities that already exists in the database.</p>
*
* <p>For an update to be made to an entity, a matching entity with the same unique identifier
* must be present in the database.</p>
*
* <p>If the entity is versioned (for example, with {@code jakarta.persistence.Version} or by
* another convention from the entity model such as having an attribute named {@code version}),
* then the version must also match. The version is automatically incremented when making
* the update if any of the other attributes of the entity are updated in the database.</p>
*
* <p>Non-matching entities are ignored and do not cause an error to be raised.</p>
*
* @param entities entities to update.
* @return the number of matching entities that were found in the database where at least one
* entity attribute is updated because of this method.
* @throws NullPointerException if either the iterable is null or any element is null.
*/
int updateAll(Iterable<T> entities);

/**
* Retrieves an entity by its id.
*
Expand Down

0 comments on commit c9b5f89

Please sign in to comment.