Package io.micronaut.data.operations
Interface RepositoryOperations
- All Superinterfaces:
io.micronaut.context.ApplicationContextProvider,io.micronaut.core.convert.ConversionServiceProvider,HintsCapableRepository
- All Known Subinterfaces:
AsyncCapableRepository,BlockingExecutorReactorRepositoryOperations,BlockingReactorRepositoryOperations,CosmosRepositoryOperations,DeleteReturningRepositoryOperations,JdbcRepositoryOperations,JpaRepositoryOperations,MongoRepositoryOperations,PrimaryRepositoryOperations,R2dbcRepositoryOperations,ReactiveCapableRepository,ReactorReactiveCapableRepository,ReactorReactiveCapableRepository
- All Known Implementing Classes:
DefaultJdbcRepositoryOperations
public interface RepositoryOperations
extends HintsCapableRepository, io.micronaut.context.ApplicationContextProvider, io.micronaut.core.convert.ConversionServiceProvider
Common interface for repository implementations to implement.
- Since:
- 1.0
- Author:
- graemerocher
-
Method Summary
Modifier and TypeMethodDescription<T> longcount(PagedQuery<T> pagedQuery) Counts all results for the given query.<T> intdelete(@NonNull DeleteOperation<T> operation) Deletes the entity.deleteAll(@NonNull DeleteBatchOperation<T> operation) Deletes all the entities of the given type.default <R> @NonNull List<R>execute(@NonNull PreparedQuery<?, R> preparedQuery) Executes the given query with parameter values returning a result.executeDelete(@NonNull PreparedQuery<?, Number> preparedQuery) Executes a delete for the given query and parameter values.executeUpdate(@NonNull PreparedQuery<?, Number> preparedQuery) Executes an update for the given query and parameter values.<T> booleanexists(@NonNull PreparedQuery<T, Boolean> preparedQuery) Execute a query that checks for existence.<T> @NonNull Iterable<T>findAll(@NonNull PagedQuery<T> query) Finds all results for the given query.<T,R> @NonNull Iterable<R> findAll(@NonNull PreparedQuery<T, R> preparedQuery) Finds all results for the given query.<T,R> R findOne(@NonNull PreparedQuery<T, R> preparedQuery) Find one by Query.<T> TFind one by ID.<R> Page<R>findPage(@NonNull PagedQuery<R> query) Find a page for the given entity and pageable.<T> @NonNull Stream<T>findStream(@NonNull PagedQuery<T> query) Finds a stream for the given arguments.<T,R> @NonNull Stream<R> findStream(@NonNull PreparedQuery<T, R> preparedQuery) Finds all results for the given query.default <T> @NonNull RuntimePersistentEntity<T>Retrieves the entity for the given type.<T> Tpersist(@NonNull InsertOperation<T> operation) Persist the operation returning a possibly new entity.default <T> @NonNull Iterable<T>persistAll(@NonNull InsertBatchOperation<T> operation) Persist all the given entities.<T> Tupdate(@NonNull UpdateOperation<T> operation) Updates the entity for the given operation.default <T> @NonNull Iterable<T>updateAll(@NonNull UpdateBatchOperation<T> operation) Updates the entities for the given operation.Methods inherited from interface io.micronaut.context.ApplicationContextProvider
getApplicationContextMethods inherited from interface io.micronaut.core.convert.ConversionServiceProvider
getConversionServiceMethods inherited from interface io.micronaut.data.operations.HintsCapableRepository
getQueryHints
-
Method Details
-
getEntity
Retrieves the entity for the given type.- Type Parameters:
T- The generic Type- Parameters:
type- The type- Returns:
- The entity
- Throws:
io.micronaut.core.beans.exceptions.IntrospectionException- if no entity exists of the given type
-
findOne
Find one by ID.- Type Parameters:
T- The generic type- Parameters:
type- The typeid- The id- Returns:
- A result or null
-
findOne
Find one by Query.- Type Parameters:
T- The generic resultTypeR- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- A result or null
-
exists
Execute a query that checks for existence.- Type Parameters:
T- The generic resultType- Parameters:
preparedQuery- The prepared query- Returns:
- A result or null
-
findAll
Finds all results for the given query.- Type Parameters:
T- The generic type- Parameters:
query- The root entity- Returns:
- An iterable result
-
count
Counts all results for the given query.- Type Parameters:
T- The generic type- Parameters:
pagedQuery- The paged query- Returns:
- An iterable result
-
findAll
Finds all results for the given query.- Type Parameters:
T- The entity typeR- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- An iterable result
-
findStream
Finds all results for the given query.- Type Parameters:
T- The entity typeR- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- An iterable result
-
findStream
Finds a stream for the given arguments.- Type Parameters:
T- The generic type- Parameters:
query- The query- Returns:
- The stream
-
findPage
Find a page for the given entity and pageable.- Type Parameters:
R- The entity generic type- Parameters:
query- The query- Returns:
- The page type
-
persist
Persist the operation returning a possibly new entity.- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The operation
-
update
Updates the entity for the given operation.- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The operation
-
updateAll
@NonNull default <T> @NonNull Iterable<T> updateAll(@NonNull @NonNull UpdateBatchOperation<T> operation) Updates the entities for the given operation.- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The updated entities
-
persistAll
@NonNull default <T> @NonNull Iterable<T> persistAll(@NonNull @NonNull InsertBatchOperation<T> operation) Persist all the given entities.- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The entities, possibly mutated
-
executeUpdate
@NonNull @NonNull Optional<Number> executeUpdate(@NonNull @NonNull PreparedQuery<?, Number> preparedQuery) Executes an update for the given query and parameter values. If it is possible to return the number of objects updated, then do so.- Parameters:
preparedQuery- The prepared query- Returns:
- An optional number with the count of the number of records updated
-
executeDelete
@NonNull default @NonNull Optional<Number> executeDelete(@NonNull @NonNull PreparedQuery<?, Number> preparedQuery) Executes a delete for the given query and parameter values. If it is possible to return the number of objects deleted, then do so.- Parameters:
preparedQuery- The prepared query- Returns:
- An optional number with the count of the number of records updated
-
execute
Executes the given query with parameter values returning a result.- Type Parameters:
R- The result type- Parameters:
preparedQuery- The prepared query- Returns:
- The result
- Since:
- 4.2.0
-
delete
Deletes the entity.- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The number of entities deleted
-
deleteAll
Deletes all the entities of the given type.- Type Parameters:
T- The generic type- Parameters:
operation- The operation- Returns:
- The number of entities deleted
-