Class PanacheEntityBase

  • Direct Known Subclasses:
    PanacheEntity

    public abstract class PanacheEntityBase
    extends Object

    Represents an entity. If your Hibernate entities extend this class they gain auto-generated accessors to all their public fields (unless annotated with Transient), as well as a lot of useful methods. Unless you have a custom ID strategy, you should not extend this class directly but extend PanacheEntity instead.

    Author:
    Stéphane Épardaud
    See Also:
    PanacheEntity
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static io.smallrye.mutiny.Uni<Long> count()
      Counts the number of this type of entity in the database.
      static 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.
      static 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.
      static 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.
      io.smallrye.mutiny.Uni<Void> delete()
      Delete this entity from the database, if it is already persisted.
      static 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.
      static io.smallrye.mutiny.Uni<Long> delete​(String query, Object... params)
      Delete all entities of this type matching the given query, with optional indexed parameters.
      static 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.
      static io.smallrye.mutiny.Uni<Long> deleteAll()
      Delete all entities of this type from the database.
      static io.smallrye.mutiny.Uni<Boolean> deleteById​(Object id)
      Delete an entity of this type by ID.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      find​(String query, io.quarkus.panache.common.Parameters params)
      Find entities using a query, with named parameters.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      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.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      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.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      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.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      find​(String query, Object... params)
      Find entities using a query, with optional indexed parameters.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      find​(String query, Map<String,​Object> params)
      Find entities using a query, with named parameters.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      findAll()
      Find all entities of this type.
      static <T extends PanacheEntityBase>
      PanacheQuery<T>
      findAll​(io.quarkus.panache.common.Sort sort)
      Find all entities of this type, in the given order.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<T>
      findById​(Object id)
      Find an entity of this type by ID.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<T>
      findById​(Object id, jakarta.persistence.LockModeType lockModeType)
      Find an entity of this type by ID and lock it.
      io.smallrye.mutiny.Uni<Void> flush()
      Flushes all pending changes to the database.
      static io.smallrye.mutiny.Uni<org.hibernate.reactive.mutiny.Mutiny.Session> getSession()
      Returns the current Mutiny.Session
      boolean isPersistent()
      Returns true if this entity is persistent in the database.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      list​(String query, io.quarkus.panache.common.Parameters params)
      Find entities matching a query, with named parameters.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      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.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      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.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      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.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      list​(String query, Object... params)
      Find entities matching a query, with optional indexed parameters.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      list​(String query, Map<String,​Object> params)
      Find entities matching a query, with named parameters.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      listAll()
      Find all entities of this type.
      static <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<List<T>>
      listAll​(io.quarkus.panache.common.Sort sort)
      Find all entities of this type, in the given order.
      <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<T>
      persist()
      Persist this entity in the database, if not already persisted.
      static io.smallrye.mutiny.Uni<Void> persist​(Iterable<?> entities)
      Persist all given entities.
      static io.smallrye.mutiny.Uni<Void> persist​(Object firstEntity, Object... entities)
      Persist all given entities.
      static io.smallrye.mutiny.Uni<Void> persist​(Stream<?> entities)
      Persist all given entities.
      <T extends PanacheEntityBase>
      io.smallrye.mutiny.Uni<T>
      persistAndFlush()
      Persist this entity in the database, if not already persisted.
      static 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.
      static io.smallrye.mutiny.Uni<Integer> update​(String query, Object... params)
      Update all entities of this type matching the given query, with optional indexed parameters.
      static 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.