Interface PanacheBlockingQuery<Entity>

All Superinterfaces:
PanacheQuery<Entity,List<Entity>,Boolean,Long>
All Known Implementing Classes:
PanacheBlockingQueryImpl

public interface PanacheBlockingQuery<Entity> extends PanacheQuery<Entity,List<Entity>,Boolean,Long>
  • Method Details

    • project

      <T> PanacheQuery<T,List<T>,Boolean,Long> project(Class<T> type)
      Defines a projection class. This will transform the returned values into instances of the given type using the following mapping rules:
      • If your query already selects some specific columns (starts with select distinct? a, b, c…) then we transform it into a query of the form: select distinct? new ProjectionClass(a, b, c)…. There must be a matching constructor that accepts the selected column types, in the right order.
      • If your query does not select any specific column (starts with from…) then we transform it into a query of the form: select new ProjectionClass(a, b, c…) from… where we fetch the list of selected columns from your projection class' single constructor, using its parameter names (or their
        invalid reference
        ProjectedFieldName
        annotations), in the same order as the constructor.
      • If this is already a project query of the form select distinct? new…, we throw a
        invalid reference
        PanacheQueryException
      Parameters:
      type - the projected class type
      Returns:
      a new query with the same state as the previous one (params, page, range, lockMode, hints, ...) but a projected result of the type type
    • stream

      Stream<Entity> stream()
      Returns the current page of results as a Stream.
      Returns:
      the current page of results as a Stream.
      See Also:
    • firstResultOptional

      Optional<Entity> firstResultOptional()
      Returns the first result of the current page index. This ignores the current page size to fetch a single result.
      Returns:
      if found, an optional containing the entity, else Optional.empty().
      See Also:
    • singleResultOptional

      Optional<Entity> singleResultOptional()
      Executes this query for the current page and return a single result.
      Returns:
      if found, an optional containing the entity, else Optional.empty().
      Throws:
      jakarta.persistence.NonUniqueResultException - if there are more than one result
      See Also: