Interface PanacheRepositoryBase<Entity,Id>
-
- Type Parameters:
Entity
- The type of entity to operate onId
- The ID type of the entity
- All Known Subinterfaces:
PanacheRepository<Entity>
public interface PanacheRepositoryBase<Entity,Id>
Represents a Repository for a specific type of entity
Entity
, with an ID type ofId
. Implementing this repository will gain you the exact same useful methods that are onPanacheEntityBase
. Unless you have a custom ID strategy, you should not implement this interface directly but implementPanacheRepository
instead.- Author:
- Stéphane Épardaud
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default io.smallrye.mutiny.Uni<Long>
count()
Counts the number of this type of entity in the database.default io.smallrye.mutiny.Uni<Long>
count(String query, io.quarkus.panache.common.Parameters params)
Counts the number of this type of entity matching the given query, with named parameters.default io.smallrye.mutiny.Uni<Long>
count(String query, Object... params)
Counts the number of this type of entity matching the given query, with optional indexed parameters.default io.smallrye.mutiny.Uni<Long>
count(String query, Map<String,Object> params)
Counts the number of this type of entity matching the given query, with named parameters.default io.smallrye.mutiny.Uni<Void>
delete(Entity entity)
Delete the given entity from the database, if it is already persisted.default io.smallrye.mutiny.Uni<Long>
delete(String query, io.quarkus.panache.common.Parameters params)
Delete all entities of this type matching the given query, with named parameters.default io.smallrye.mutiny.Uni<Long>
delete(String query, Object... params)
Delete all entities of this type matching the given query, with optional indexed parameters.default io.smallrye.mutiny.Uni<Long>
delete(String query, Map<String,Object> params)
Delete all entities of this type matching the given query, with named parameters.default io.smallrye.mutiny.Uni<Long>
deleteAll()
Delete all entities of this type from the database.default io.smallrye.mutiny.Uni<Boolean>
deleteById(Id id)
Delete an entity of this type by ID.default PanacheQuery<Entity>
find(String query, io.quarkus.panache.common.Parameters params)
Find entities using a query, with named parameters.default PanacheQuery<Entity>
find(String query, io.quarkus.panache.common.Sort sort, io.quarkus.panache.common.Parameters params)
Find entities using a query and the given sort options, with named parameters.default PanacheQuery<Entity>
find(String query, io.quarkus.panache.common.Sort sort, Object... params)
Find entities using a query and the given sort options, with optional indexed parameters.default PanacheQuery<Entity>
find(String query, io.quarkus.panache.common.Sort sort, Map<String,Object> params)
Find entities using a query and the given sort options, with named parameters.default PanacheQuery<Entity>
find(String query, Object... params)
Find entities using a query, with optional indexed parameters.default PanacheQuery<Entity>
find(String query, Map<String,Object> params)
Find entities using a query, with named parameters.default PanacheQuery<Entity>
findAll()
Find all entities of this type.default PanacheQuery<Entity>
findAll(io.quarkus.panache.common.Sort sort)
Find all entities of this type, in the given order.default io.smallrye.mutiny.Uni<Entity>
findById(Id id)
Find an entity of this type by ID.default io.smallrye.mutiny.Uni<Entity>
findById(Id id, jakarta.persistence.LockModeType lockModeType)
Find an entity of this type by ID and lock it.default io.smallrye.mutiny.Uni<Void>
flush()
Flushes all pending changes to the database.default io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Session>
getSession()
Returns the currentMutiny.Session
default boolean
isPersistent(Entity entity)
Returns true if the given entity is persistent in the database.default io.smallrye.mutiny.Uni<List<Entity>>
list(String query, io.quarkus.panache.common.Parameters params)
Find entities matching a query, with named parameters.default io.smallrye.mutiny.Uni<List<Entity>>
list(String query, io.quarkus.panache.common.Sort sort, io.quarkus.panache.common.Parameters params)
Find entities matching a query and the given sort options, with named parameters.default io.smallrye.mutiny.Uni<List<Entity>>
list(String query, io.quarkus.panache.common.Sort sort, Object... params)
Find entities matching a query and the given sort options, with optional indexed parameters.default io.smallrye.mutiny.Uni<List<Entity>>
list(String query, io.quarkus.panache.common.Sort sort, Map<String,Object> params)
Find entities matching a query and the given sort options, with named parameters.default io.smallrye.mutiny.Uni<List<Entity>>
list(String query, Object... params)
Find entities matching a query, with optional indexed parameters.default io.smallrye.mutiny.Uni<List<Entity>>
list(String query, Map<String,Object> params)
Find entities matching a query, with named parameters.default io.smallrye.mutiny.Uni<List<Entity>>
listAll()
Find all entities of this type.default io.smallrye.mutiny.Uni<List<Entity>>
listAll(io.quarkus.panache.common.Sort sort)
Find all entities of this type, in the given order.default io.smallrye.mutiny.Uni<Entity>
persist(Entity entity)
Persist the given entity in the database, if not already persisted.default io.smallrye.mutiny.Uni<Void>
persist(Entity firstEntity, Entity... entities)
Persist all given entities.default io.smallrye.mutiny.Uni<Void>
persist(Iterable<Entity> entities)
Persist all given entities.default io.smallrye.mutiny.Uni<Void>
persist(Stream<Entity> entities)
Persist all given entities.default io.smallrye.mutiny.Uni<Entity>
persistAndFlush(Entity entity)
Persist the given entity in the database, if not already persisted.default io.smallrye.mutiny.Uni<Integer>
update(String query, io.quarkus.panache.common.Parameters params)
Update all entities of this type matching the given query, with named parameters.default io.smallrye.mutiny.Uni<Integer>
update(String query, Object... params)
Update all entities of this type matching the given query, with optional indexed parameters.default io.smallrye.mutiny.Uni<Integer>
update(String query, Map<String,Object> params)
Update all entities of this type matching the given query, with named parameters.
-
-
-
Method Detail
-
getSession
default io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Session> getSession()
Returns the currentMutiny.Session
- Returns:
- the current
Mutiny.Session
-
persist
@CheckReturnValue default io.smallrye.mutiny.Uni<Entity> persist(Entity entity)
Persist the given entity in the database, if not already persisted.- Parameters:
entity
- the entity to persist.- Returns:
- See Also:
isPersistent(Object)
,persist(Iterable)
,persist(Stream)
,persist(Object, Object...)
-
persistAndFlush
@CheckReturnValue default io.smallrye.mutiny.Uni<Entity> persistAndFlush(Entity entity)
Persist the given entity in the database, if not already persisted. Then flushes all pending changes to the database.- Parameters:
entity
- the entity to persist.- Returns:
- See Also:
isPersistent(Object)
,persist(Iterable)
,persist(Stream)
,persist(Object, Object...)
-
delete
@CheckReturnValue default io.smallrye.mutiny.Uni<Void> delete(Entity entity)
Delete the given entity from the database, if it is already persisted.- Parameters:
entity
- the entity to delete.- Returns:
- See Also:
isPersistent(Object)
,delete(String, Object...)
,delete(String, Map)
,delete(String, Parameters)
,deleteAll()
-
isPersistent
default boolean isPersistent(Entity entity)
Returns true if the given entity is persistent in the database. If yes, all modifications to its persistent fields will be automatically committed to the database at transaction commit time.- Parameters:
entity
- the entity to check- Returns:
- true if the entity is persistent in the database.
-
flush
@CheckReturnValue default io.smallrye.mutiny.Uni<Void> flush()
Flushes all pending changes to the database.- Returns:
-
findById
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Entity> findById(Id id)
Find an entity of this type by ID.- Parameters:
id
- the ID of the entity to find.- Returns:
- the entity found, or
null
if not found.
-
findById
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Entity> findById(Id id, jakarta.persistence.LockModeType lockModeType)
Find an entity of this type by ID and lock it.- Parameters:
id
- the ID of the entity to find.lockModeType
- the locking strategy to be used when retrieving the entity.- Returns:
- the entity found, or
null
if not found.
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, Object... params)
Find entities using a query, with optional indexed parameters.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
find(String, Sort, Object...)
,find(String, Map)
,find(String, Parameters)
,list(String, Object...)
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, io.quarkus.panache.common.Sort sort, Object... params)
Find entities using a query and the given sort options, with optional indexed parameters.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
- optional sequence of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
find(String, Object...)
,find(String, Sort, Map)
,find(String, Sort, Parameters)
,list(String, Sort, Object...)
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, Map<String,Object> params)
Find entities using a query, with named parameters.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
find(String, Sort, Map)
,find(String, Object...)
,find(String, Parameters)
,list(String, Map)
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, io.quarkus.panache.common.Sort sort, Map<String,Object> params)
Find entities using a query and the given sort options, with named parameters.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Map
of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
find(String, Map)
,find(String, Sort, Object...)
,find(String, Sort, Parameters)
,list(String, Sort, Map)
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, io.quarkus.panache.common.Parameters params)
Find entities using a query, with named parameters.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
find(String, Sort, Parameters)
,find(String, Map)
,find(String, Parameters)
,list(String, Parameters)
-
find
@GenerateBridge default PanacheQuery<Entity> find(String query, io.quarkus.panache.common.Sort sort, io.quarkus.panache.common.Parameters params)
Find entities using a query and the given sort options, with named parameters.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Parameters
of indexed parameters- Returns:
- a new
PanacheQuery
instance for the given query - See Also:
find(String, Parameters)
,find(String, Sort, Map)
,find(String, Sort, Parameters)
,list(String, Sort, Parameters)
-
findAll
@GenerateBridge default PanacheQuery<Entity> findAll()
Find all entities of this type.- Returns:
- a new
PanacheQuery
instance to find all entities of this type. - See Also:
findAll(Sort)
,listAll()
-
findAll
@GenerateBridge default PanacheQuery<Entity> findAll(io.quarkus.panache.common.Sort sort)
Find all entities of this type, in the given order.- Parameters:
sort
- the sort order to use- Returns:
- a new
PanacheQuery
instance to find all entities of this type. - See Also:
findAll()
,listAll(Sort)
-
list
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> list(String query, Object... params)
Find entities matching a query, with optional indexed parameters. This method is a shortcut forfind(query, params).list()
.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
list(String, Sort, Object...)
,list(String, Map)
,list(String, Parameters)
,find(String, Object...)
-
list
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> list(String query, io.quarkus.panache.common.Sort sort, Object... params)
Find entities matching a query and the given sort options, with optional indexed parameters. This method is a shortcut forfind(query, sort, params).list()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
- optional sequence of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
list(String, Object...)
,list(String, Sort, Map)
,list(String, Sort, Parameters)
,find(String, Sort, Object...)
-
list
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> list(String query, Map<String,Object> params)
Find entities matching a query, with named parameters. This method is a shortcut forfind(query, params).list()
.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- a
List
containing all results, without paging - See Also:
list(String, Sort, Map)
,list(String, Object...)
,list(String, Parameters)
,find(String, Map)
-
list
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> list(String query, io.quarkus.panache.common.Sort sort, Map<String,Object> params)
Find entities matching a query and the given sort options, with named parameters. This method is a shortcut forfind(query, sort, params).list()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Map
of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
list(String, Map)
,list(String, Sort, Object...)
,list(String, Sort, Parameters)
,find(String, Sort, Map)
-
list
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> list(String query, io.quarkus.panache.common.Parameters params)
Find entities matching a query, with named parameters. This method is a shortcut forfind(query, params).list()
.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- a
List
containing all results, without paging - See Also:
list(String, Sort, Parameters)
,list(String, Object...)
,list(String, Map)
,find(String, Parameters)
-
list
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> list(String query, io.quarkus.panache.common.Sort sort, io.quarkus.panache.common.Parameters params)
Find entities matching a query and the given sort options, with named parameters. This method is a shortcut forfind(query, sort, params).list()
.- Parameters:
query
- aquery string
sort
- the sort strategy to useparams
-Parameters
of indexed parameters- Returns:
- a
List
containing all results, without paging - See Also:
list(String, Parameters)
,list(String, Sort, Object...)
,list(String, Sort, Map)
,find(String, Sort, Parameters)
-
listAll
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> listAll()
Find all entities of this type. This method is a shortcut forfindAll().list()
.- Returns:
- a
List
containing all results, without paging - See Also:
listAll(Sort)
,findAll()
-
listAll
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<List<Entity>> listAll(io.quarkus.panache.common.Sort sort)
Find all entities of this type, in the given order. This method is a shortcut forfindAll(sort).list()
.- Parameters:
sort
- the sort order to use- Returns:
- a
List
containing all results, without paging - See Also:
listAll()
,findAll(Sort)
-
count
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> count()
Counts the number of this type of entity in the database.- Returns:
- the number of this type of entity in the database.
- See Also:
count(String, Object...)
,count(String, Map)
,count(String, Parameters)
-
count
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> count(String query, Object... params)
Counts the number of this type of entity matching the given query, with optional indexed parameters.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- the number of entities counted.
- See Also:
count()
,count(String, Map)
,count(String, Parameters)
-
count
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> count(String query, Map<String,Object> params)
Counts the number of this type of entity matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- the number of entities counted.
- See Also:
count()
,count(String, Object...)
,count(String, Parameters)
-
count
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> count(String query, io.quarkus.panache.common.Parameters params)
Counts the number of this type of entity matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- the number of entities counted.
- See Also:
count()
,count(String, Object...)
,count(String, Map)
-
deleteAll
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> deleteAll()
Delete all entities of this type from the database. WARNING: the default implementation of this method uses a bulk delete query and ignores cascading rules from the JPA model.- Returns:
- the number of entities deleted.
- See Also:
delete(String, Object...)
,delete(String, Map)
,delete(String, Parameters)
-
deleteById
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Boolean> deleteById(Id id)
Delete an entity of this type by ID.- Parameters:
id
- the ID of the entity to delete.- Returns:
- false if the entity was not deleted (not found).
-
delete
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> delete(String query, Object... params)
Delete all entities of this type matching the given query, with optional indexed parameters. WARNING: the default implementation of this method uses a bulk delete query and ignores cascading rules from the JPA model.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- the number of entities deleted.
- See Also:
deleteAll()
,delete(String, Map)
,delete(String, Parameters)
-
delete
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> delete(String query, Map<String,Object> params)
Delete all entities of this type matching the given query, with named parameters. WARNING: the default implementation of this method uses a bulk delete query and ignores cascading rules from the JPA model.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- the number of entities deleted.
- See Also:
deleteAll()
,delete(String, Object...)
,delete(String, Parameters)
-
delete
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Long> delete(String query, io.quarkus.panache.common.Parameters params)
Delete all entities of this type matching the given query, with named parameters. WARNING: the default implementation of this method uses a bulk delete query and ignores cascading rules from the JPA model.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- the number of entities deleted.
- See Also:
deleteAll()
,delete(String, Object...)
,delete(String, Map)
-
persist
@CheckReturnValue default io.smallrye.mutiny.Uni<Void> persist(Iterable<Entity> entities)
Persist all given entities.- Parameters:
entities
- the entities to persist- Returns:
- See Also:
persist(Object)
,persist(Stream)
,persist(Object,Object...)
-
persist
@CheckReturnValue default io.smallrye.mutiny.Uni<Void> persist(Stream<Entity> entities)
Persist all given entities.- Parameters:
entities
- the entities to persist- Returns:
- See Also:
persist(Object)
,persist(Iterable)
,persist(Object,Object...)
-
persist
@CheckReturnValue default io.smallrye.mutiny.Uni<Void> persist(Entity firstEntity, Entity... entities)
Persist all given entities.- Parameters:
entities
- the entities to persist- Returns:
- See Also:
persist(Object)
,persist(Stream)
,persist(Iterable)
-
update
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Integer> update(String query, Object... params)
Update all entities of this type matching the given query, with optional indexed parameters.- Parameters:
query
- aquery string
params
- optional sequence of indexed parameters- Returns:
- the number of entities updated.
- See Also:
update(String, Map)
,update(String, Parameters)
-
update
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Integer> update(String query, Map<String,Object> params)
Update all entities of this type matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Map
of named parameters- Returns:
- the number of entities updated.
- See Also:
update(String, Object...)
,update(String, Parameters)
-
update
@CheckReturnValue @GenerateBridge default io.smallrye.mutiny.Uni<Integer> update(String query, io.quarkus.panache.common.Parameters params)
Update all entities of this type matching the given query, with named parameters.- Parameters:
query
- aquery string
params
-Parameters
of named parameters- Returns:
- the number of entities updated.
- See Also:
update(String, Object...)
,update(String, Map)
-
-