E
- The entity typeID
- The ID typepublic interface AsyncCrudRepository<E,ID> extends GenericRepository<E,ID>
CrudRepository
.Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<java.lang.Long> |
count()
Returns the number of entities available.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
delete(E entity)
Deletes a given entity.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteAll()
Deletes all entities managed by the repository.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteAll(@NotNull java.lang.Iterable<? extends E> entities)
Deletes the given entities.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
deleteById(ID id)
Deletes the entity with the given id.
|
java.util.concurrent.CompletableFuture<java.lang.Boolean> |
existsById(ID id)
Returns whether an entity with the given id exists.
|
java.util.concurrent.CompletableFuture<? extends java.lang.Iterable<E>> |
findAll()
Returns all instances of the type.
|
java.util.concurrent.CompletableFuture<E> |
findById(ID id)
Retrieves an entity by its id.
|
<S extends E> |
save(S entity)
Saves the given valid entity, returning a possibly new entity representing the saved state.
|
<S extends E> |
saveAll(@Valid @NotNull java.lang.Iterable<S> entities)
Saves all given entities, possibly returning new instances representing the saved state.
|
@NonNull <S extends E> java.util.concurrent.CompletableFuture<S> save(@Valid @NotNull @NonNull S entity)
S
- The generic typeentity
- The entity to save. Must not be null.javax.validation.ConstraintViolationException
- if the entity is null or invalid.@NonNull <S extends E> java.util.concurrent.CompletableFuture<? extends java.lang.Iterable<S>> saveAll(@Valid @NotNull @NonNull @Valid @NotNull java.lang.Iterable<S> entities)
S
- The generic typeentities
- The entities to saved. Must not be null.javax.validation.ConstraintViolationException
- if the entities are null.@NonNull java.util.concurrent.CompletableFuture<E> findById(@NotNull @NonNull ID id)
id
- The ID of the entity to retrieve. Must not be null.EmptyResultException
if it the entity is not foundjavax.validation.ConstraintViolationException
- if the id is null.EmptyResultException
- if no entity exists for the ID@NonNull java.util.concurrent.CompletableFuture<java.lang.Boolean> existsById(@NotNull @NonNull ID id)
id
- must not be null.javax.validation.ConstraintViolationException
- if the id is null.@NonNull java.util.concurrent.CompletableFuture<? extends java.lang.Iterable<E>> findAll()
@NonNull java.util.concurrent.CompletableFuture<java.lang.Long> count()
@NonNull java.util.concurrent.CompletableFuture<java.lang.Void> deleteById(@NonNull @NotNull ID id)
id
- must not be null.javax.validation.ConstraintViolationException
- if the entity is null.@NonNull java.util.concurrent.CompletableFuture<java.lang.Void> delete(@NonNull @NotNull E entity)
entity
- The entity to deletejavax.validation.ConstraintViolationException
- if the entity is null.@NonNull java.util.concurrent.CompletableFuture<java.lang.Void> deleteAll(@NonNull @NotNull @NotNull java.lang.Iterable<? extends E> entities)
entities
- The entities to deletejavax.validation.ConstraintViolationException
- if the entity is null.@NonNull java.util.concurrent.CompletableFuture<java.lang.Void> deleteAll()