Interface PanacheRepositoryBase<Entity,​Id>

  • Type Parameters:
    Entity - The type of entity to operate on
    Id - 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 of Id. Implementing this repository will gain you the exact same useful methods that are on PanacheEntityBase. Unless you have a custom ID strategy, you should not implement this interface directly but implement PanacheRepository instead.

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default long count()
      Counts the number of this type of entity in the database.
      default 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 long count​(String query, Object... params)
      Counts the number of this type of entity matching the given query, with optional indexed parameters.
      default long count​(String query, Map<String,​Object> params)
      Counts the number of this type of entity matching the given query, with named parameters.
      default void delete​(Entity entity)
      Delete the given entity from the database, if it is already persisted.
      default long deleteAll()
      Delete all entities of this type from the database.
      default boolean deleteById​(Id id)
      Delete an entity of this type by ID.
      default long deleteByQuery​(String query, io.quarkus.panache.common.Parameters params)
      Delete all entities of this type matching the given query, with named parameters.
      default long deleteByQuery​(String query, Object... params)
      Delete all entities of this type matching the given query, with optional indexed parameters.
      default long deleteByQuery​(String query, Map<String,​Object> params)
      Delete all entities of this type matching the given query, with named parameters.
      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 Entity findById​(Id id)
      Find an entity of this type by ID.
      default Entity findById​(Id id, jakarta.persistence.LockModeType lockModeType)
      Find an entity of this type by ID and lock it.
      default Optional<Entity> findByIdOptional​(Id id)
      Find an entity of this type by ID.
      default Optional<Entity> findByIdOptional​(Id id, jakarta.persistence.LockModeType lockModeType)
      Find an entity of this type by ID.
      default void flush()
      Flushes all pending changes to the database using the EntityManager for the entity class.
      default jakarta.persistence.EntityManager getEntityManager()
      Returns the EntityManager for the entity class for extra operations (eg.
      default boolean isPersistent​(Entity entity)
      Returns true if the given entity is persistent in the database.
      default List<Entity> list​(String query, io.quarkus.panache.common.Parameters params)
      Find entities matching a query, with named parameters.
      default 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 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 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 List<Entity> list​(String query, Object... params)
      Find entities matching a query, with optional indexed parameters.
      default List<Entity> list​(String query, Map<String,​Object> params)
      Find entities matching a query, with named parameters.
      default List<Entity> listAll()
      Find all entities of this type.
      default List<Entity> listAll​(io.quarkus.panache.common.Sort sort)
      Find all entities of this type, in the given order.
      default void persist​(Entity entity)
      Persist the given entity in the database, if not already persisted.
      default void persist​(Entity firstEntity, Entity... entities)
      Persist all given entities.
      default void persist​(Iterable<Entity> entities)
      Persist all given entities.
      default void persist​(Stream<Entity> entities)
      Persist all given entities.
      default void persistAndFlush​(Entity entity)
      Persist the given entity in the database, if not already persisted.
      default Stream<Entity> stream​(String query, io.quarkus.panache.common.Parameters params)
      Find entities matching a query, with named parameters.
      default Stream<Entity> stream​(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 Stream<Entity> stream​(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 Stream<Entity> stream​(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 Stream<Entity> stream​(String query, Object... params)
      Find entities matching a query, with optional indexed parameters.
      default Stream<Entity> stream​(String query, Map<String,​Object> params)
      Find entities matching a query, with named parameters.
      default Stream<Entity> streamAll()
      Find all entities of this type, in the given order.
      default Stream<Entity> streamAll​(io.quarkus.panache.common.Sort sort)
      Find all entities of this type.
      default int update​(String query, io.quarkus.panache.common.Parameters params)
      Update all entities of this type matching the given query, with named parameters.
      default int update​(String query, Object... params)
      Update all entities of this type matching the given query, with optional indexed parameters.
      default int update​(String query, Map<String,​Object> params)
      Update all entities of this type matching the given query, with named parameters.