public interface RepositoryOperations
extends io.micronaut.context.ApplicationContextProvider
Modifier and Type | Method and Description |
---|---|
<T> long |
count(PagedQuery<T> pagedQuery)
Counts all results for the given query.
|
<T> int |
delete(DeleteOperation<T> operation)
Deletes the entity.
|
<T> java.util.Optional<java.lang.Number> |
deleteAll(DeleteBatchOperation<T> operation)
Deletes all the entities of the given type.
|
default java.util.Optional<java.lang.Number> |
executeDelete(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes a delete for the given query and parameter values.
|
java.util.Optional<java.lang.Number> |
executeUpdate(PreparedQuery<?,java.lang.Number> preparedQuery)
Executes an update for the given query and parameter values.
|
<T> boolean |
exists(PreparedQuery<T,java.lang.Boolean> preparedQuery)
Execute a query that checks for existence.
|
<T> java.lang.Iterable<T> |
findAll(PagedQuery<T> query)
Finds all results for the given query.
|
<T,R> java.lang.Iterable<R> |
findAll(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
<T> T |
findOne(java.lang.Class<T> type,
java.io.Serializable id)
Find one by ID.
|
<T,R> R |
findOne(PreparedQuery<T,R> preparedQuery)
Find one by Query.
|
<R> Page<R> |
findPage(PagedQuery<R> query)
Find a page for the given entity and pageable.
|
<T> java.util.stream.Stream<T> |
findStream(PagedQuery<T> query)
Finds a stream for the given arguments.
|
<T,R> java.util.stream.Stream<R> |
findStream(PreparedQuery<T,R> preparedQuery)
Finds all results for the given query.
|
default <T> RuntimePersistentEntity<T> |
getEntity(java.lang.Class<T> type)
Retrieves the entity for the given type.
|
default java.util.Map<java.lang.String,java.lang.Object> |
getQueryHints(StoredQuery<?,?> storedQuery)
Obtain any custom query hints for this method and repository implementation.
|
<T> T |
persist(InsertOperation<T> operation)
Persist the operation returning a possibly new entity.
|
default <T> java.lang.Iterable<T> |
persistAll(InsertBatchOperation<T> operation)
Persist all the given entities.
|
<T> T |
update(UpdateOperation<T> operation)
Updates the entity for the given operation.
|
default <T> java.lang.Iterable<T> |
updateAll(UpdateBatchOperation<T> operation)
Updates the entities for the given operation.
|
@NonNull default <T> RuntimePersistentEntity<T> getEntity(@NonNull java.lang.Class<T> type)
T
- The generic Typetype
- The typeio.micronaut.core.beans.exceptions.IntrospectionException
- if no entity exists of the given type@Nullable <T> T findOne(@NonNull java.lang.Class<T> type, @NonNull java.io.Serializable id)
T
- The generic typetype
- The typeid
- The id@Nullable <T,R> R findOne(@NonNull PreparedQuery<T,R> preparedQuery)
T
- The generic resultTypeR
- The result typepreparedQuery
- The prepared query<T> boolean exists(@NonNull PreparedQuery<T,java.lang.Boolean> preparedQuery)
T
- The generic resultTypepreparedQuery
- The prepared query@NonNull <T> java.lang.Iterable<T> findAll(@NonNull PagedQuery<T> query)
T
- The generic typequery
- The root entity<T> long count(PagedQuery<T> pagedQuery)
T
- The generic typepagedQuery
- The paged query@NonNull <T,R> java.lang.Iterable<R> findAll(@NonNull PreparedQuery<T,R> preparedQuery)
T
- The entity typeR
- The result typepreparedQuery
- The prepared query@NonNull <T,R> java.util.stream.Stream<R> findStream(@NonNull PreparedQuery<T,R> preparedQuery)
T
- The entity typeR
- The result typepreparedQuery
- The prepared query@NonNull <T> java.util.stream.Stream<T> findStream(@NonNull PagedQuery<T> query)
T
- The generic typequery
- The query<R> Page<R> findPage(@NonNull PagedQuery<R> query)
R
- The entity generic typequery
- The query@NonNull <T> T persist(@NonNull InsertOperation<T> operation)
T
- The generic typeoperation
- The operation@NonNull <T> T update(@NonNull UpdateOperation<T> operation)
T
- The generic typeoperation
- The operation@NonNull default <T> java.lang.Iterable<T> updateAll(@NonNull UpdateBatchOperation<T> operation)
T
- The generic typeoperation
- The operation@NonNull default <T> java.lang.Iterable<T> persistAll(@NonNull InsertBatchOperation<T> operation)
T
- The generic typeoperation
- The operation@NonNull java.util.Optional<java.lang.Number> executeUpdate(@NonNull PreparedQuery<?,java.lang.Number> preparedQuery)
preparedQuery
- The prepared query@NonNull default java.util.Optional<java.lang.Number> executeDelete(@NonNull PreparedQuery<?,java.lang.Number> preparedQuery)
preparedQuery
- The prepared query<T> int delete(@NonNull DeleteOperation<T> operation)
T
- The generic typeoperation
- The operation<T> java.util.Optional<java.lang.Number> deleteAll(@NonNull DeleteBatchOperation<T> operation)
T
- The generic typeoperation
- The operation@NonNull default java.util.Map<java.lang.String,java.lang.Object> getQueryHints(@NonNull StoredQuery<?,?> storedQuery)
storedQuery
- The stored query