Interface JpaQuery<T>

  • Type Parameters:
    T - Query result type
    All Superinterfaces:
    com.holonplatform.core.datastore.DataTarget.DataTargetSupport<JpaQuery<T>>, com.querydsl.core.types.Expression<T>, com.holonplatform.core.ExpressionResolver.ExpressionResolverBuilder<JpaQuery<T>>, com.querydsl.core.support.ExtendedSubQuery<T>, com.querydsl.core.Fetchable<T>, com.querydsl.core.FetchableQuery<T,​com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.core.FilteredClause<com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.jpa.JPQLQuery<T>, com.querydsl.core.Query<com.querydsl.jpa.JPQLQuery<T>>, com.holonplatform.core.query.QueryAggregation.QueryAggregationSupport<JpaQuery<T>>, com.holonplatform.core.query.QueryBuilder<JpaQuery<T>>, com.holonplatform.core.query.QueryFilter.QueryFilterSupport<JpaQuery<T>>, com.holonplatform.core.query.QuerySort.QuerySortSupport<JpaQuery<T>>, Serializable, com.querydsl.core.SimpleQuery<com.querydsl.jpa.JPQLQuery<T>>, com.querydsl.core.types.SubQueryExpression<T>
    All Known Implementing Classes:
    DefaultJpaQuery

    public interface JpaQuery<T>
    extends com.holonplatform.core.query.QueryBuilder<JpaQuery<T>>, com.querydsl.jpa.JPQLQuery<T>
    QueryDSL JPA query interface.

    Combines the features of the standard QueryDSL JPQLQuery with the Holon QueryBuilder, allowing to seamlessy use the default core query architecture expressions (for example DataTarget, QueryFilter, QuerySort and QueryAggregation) for query definition.

    Provides some convenience methods to obtain query results providing a projection expression, such as list(Expression), singleResult(Expression), uniqueResult(Expression).

    The QueryDsl Datastore commodity can be used to obtain a new JpaQuery instance through the QueryDsl.query() method. Example:

     JpaQuery q = getDatastore().create(QueryDsl.class).query();
     
    Since:
    5.1.0
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default long count()
      Shorter for count(*) on selected entity path.
      JpaQuery<T> distinct()
      JpaQuery<T> fetchAll()
      JpaQuery<T> fetchJoin()
      <P> JpaQuery<T> from​(com.querydsl.core.types.CollectionExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      JpaQuery<T> from​(com.querydsl.core.types.EntityPath<?>... sources)
      JpaQuery<T> groupBy​(com.querydsl.core.types.Expression<?>... o)
      JpaQuery<T> having​(com.querydsl.core.types.Predicate... o)
      <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target)
      <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.EntityPath<P> target)
      <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.EntityPath<P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.MapExpression<?,​P> target)
      <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.MapExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> join​(com.querydsl.core.types.CollectionExpression<?,​P> target)
      <P> JpaQuery<T> join​(com.querydsl.core.types.CollectionExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> join​(com.querydsl.core.types.EntityPath<P> target)
      <P> JpaQuery<T> join​(com.querydsl.core.types.EntityPath<P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> join​(com.querydsl.core.types.MapExpression<?,​P> target)
      <P> JpaQuery<T> join​(com.querydsl.core.types.MapExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target)
      <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.EntityPath<P> target)
      <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.EntityPath<P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.MapExpression<?,​P> target)
      <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.MapExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      JpaQuery<T> limit​(long limit)
      default <RT> List<RT> list​(com.querydsl.core.types.Expression<RT> projection)
      Convenience method to execute the query and return results as List.
      JpaQuery<T> offset​(long offset)
      JpaQuery<T> on​(com.querydsl.core.types.Predicate... condition)
      JpaQuery<T> orderBy​(com.querydsl.core.types.OrderSpecifier<?>... o)
      JpaQuery<T> restrict​(com.querydsl.core.QueryModifiers modifiers)
      <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target)
      <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.EntityPath<P> target)
      <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.EntityPath<P> target, com.querydsl.core.types.Path<P> alias)
      <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.MapExpression<?,​P> target)
      <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.MapExpression<?,​P> target, com.querydsl.core.types.Path<P> alias)
      JpaQuery<com.querydsl.core.Tuple> select​(com.querydsl.core.types.Expression<?>... exprs)
      <U> JpaQuery<U> select​(com.querydsl.core.types.Expression<U> expr)
      <P> JpaQuery<T> set​(com.querydsl.core.types.ParamExpression<P> param, P value)
      JpaQuery<T> setFlushMode​(javax.persistence.FlushModeType flushMode)
      Set the query FlushModeType.
      JpaQuery<T> setHint​(String name, Object value)
      Add a query hint.
      JpaQuery<T> setLockMode​(javax.persistence.LockModeType lockMode)
      Set the query LockModeType.
      default <RT> RT singleResult​(com.querydsl.core.types.Expression<RT> projection)
      Convenience method to execute the query and return a single result.
      default <RT> RT uniqueResult​(com.querydsl.core.types.Expression<RT> projection)
      Convenience method to execute the query and return the result, which is expected to be unique.
      JpaQuery<T> where​(com.querydsl.core.types.Predicate... o)
      • Methods inherited from interface com.holonplatform.core.datastore.DataTarget.DataTargetSupport

        target, target
      • Methods inherited from interface com.querydsl.core.types.Expression

        accept, getType
      • Methods inherited from interface com.holonplatform.core.ExpressionResolver.ExpressionResolverBuilder

        withExpressionResolver
      • Methods inherited from interface com.querydsl.core.support.ExtendedSubQuery

        contains, contains, eq, eq, exists, goe, goe, gt, gt, in, in, isNotNull, isNull, loe, loe, lt, lt, ne, ne, notExists
      • Methods inherited from interface com.querydsl.core.Fetchable

        fetch, fetchCount, fetchFirst, fetchOne, fetchResults, iterate, stream
      • Methods inherited from interface com.querydsl.core.FetchableQuery

        transform
      • Methods inherited from interface com.holonplatform.core.query.QueryAggregation.QueryAggregationSupport

        aggregate, aggregate, aggregate
      • Methods inherited from interface com.holonplatform.core.query.QueryBuilder

        getQueryConfiguration, limit, offset, parameter, parameter, restrict
      • Methods inherited from interface com.holonplatform.core.query.QueryFilter.QueryFilterSupport

        filter, filter, filter
      • Methods inherited from interface com.holonplatform.core.query.QuerySort.QuerySortSupport

        sort, sort, sort
      • Methods inherited from interface com.querydsl.core.types.SubQueryExpression

        getMetadata
    • Method Detail

      • groupBy

        JpaQuery<T> groupBy​(com.querydsl.core.types.Expression<?>... o)
        Specified by:
        groupBy in interface com.querydsl.core.Query<T>
      • having

        JpaQuery<T> having​(com.querydsl.core.types.Predicate... o)
        Specified by:
        having in interface com.querydsl.core.Query<T>
      • limit

        JpaQuery<T> limit​(long limit)
        Specified by:
        limit in interface com.querydsl.core.SimpleQuery<T>
      • offset

        JpaQuery<T> offset​(long offset)
        Specified by:
        offset in interface com.querydsl.core.SimpleQuery<T>
      • restrict

        JpaQuery<T> restrict​(com.querydsl.core.QueryModifiers modifiers)
        Specified by:
        restrict in interface com.querydsl.core.SimpleQuery<T>
      • orderBy

        JpaQuery<T> orderBy​(com.querydsl.core.types.OrderSpecifier<?>... o)
        Specified by:
        orderBy in interface com.querydsl.core.SimpleQuery<T>
      • set

        <P> JpaQuery<T> set​(com.querydsl.core.types.ParamExpression<P> param,
                            P value)
        Specified by:
        set in interface com.querydsl.core.SimpleQuery<T>
      • distinct

        JpaQuery<T> distinct()
        Specified by:
        distinct in interface com.holonplatform.core.query.QueryBuilder<T>
        Specified by:
        distinct in interface com.querydsl.core.SimpleQuery<T>
      • where

        JpaQuery<T> where​(com.querydsl.core.types.Predicate... o)
        Specified by:
        where in interface com.querydsl.core.FilteredClause<T>
      • from

        JpaQuery<T> from​(com.querydsl.core.types.EntityPath<?>... sources)
        Specified by:
        from in interface com.querydsl.jpa.JPQLQuery<T>
      • from

        <P> JpaQuery<T> from​(com.querydsl.core.types.CollectionExpression<?,​P> target,
                             com.querydsl.core.types.Path<P> alias)
        Specified by:
        from in interface com.querydsl.jpa.JPQLQuery<T>
      • innerJoin

        <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.EntityPath<P> target)
        Specified by:
        innerJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • innerJoin

        <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.EntityPath<P> target,
                                  com.querydsl.core.types.Path<P> alias)
        Specified by:
        innerJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • innerJoin

        <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target)
        Specified by:
        innerJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • innerJoin

        <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target,
                                  com.querydsl.core.types.Path<P> alias)
        Specified by:
        innerJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • innerJoin

        <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.MapExpression<?,​P> target)
        Specified by:
        innerJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • innerJoin

        <P> JpaQuery<T> innerJoin​(com.querydsl.core.types.MapExpression<?,​P> target,
                                  com.querydsl.core.types.Path<P> alias)
        Specified by:
        innerJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • join

        <P> JpaQuery<T> join​(com.querydsl.core.types.EntityPath<P> target)
        Specified by:
        join in interface com.querydsl.jpa.JPQLQuery<T>
      • join

        <P> JpaQuery<T> join​(com.querydsl.core.types.EntityPath<P> target,
                             com.querydsl.core.types.Path<P> alias)
        Specified by:
        join in interface com.querydsl.jpa.JPQLQuery<T>
      • join

        <P> JpaQuery<T> join​(com.querydsl.core.types.CollectionExpression<?,​P> target)
        Specified by:
        join in interface com.querydsl.jpa.JPQLQuery<T>
      • join

        <P> JpaQuery<T> join​(com.querydsl.core.types.CollectionExpression<?,​P> target,
                             com.querydsl.core.types.Path<P> alias)
        Specified by:
        join in interface com.querydsl.jpa.JPQLQuery<T>
      • join

        <P> JpaQuery<T> join​(com.querydsl.core.types.MapExpression<?,​P> target)
        Specified by:
        join in interface com.querydsl.jpa.JPQLQuery<T>
      • join

        <P> JpaQuery<T> join​(com.querydsl.core.types.MapExpression<?,​P> target,
                             com.querydsl.core.types.Path<P> alias)
        Specified by:
        join in interface com.querydsl.jpa.JPQLQuery<T>
      • leftJoin

        <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.EntityPath<P> target)
        Specified by:
        leftJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • leftJoin

        <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.EntityPath<P> target,
                                 com.querydsl.core.types.Path<P> alias)
        Specified by:
        leftJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • leftJoin

        <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target)
        Specified by:
        leftJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • leftJoin

        <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target,
                                 com.querydsl.core.types.Path<P> alias)
        Specified by:
        leftJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • leftJoin

        <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.MapExpression<?,​P> target)
        Specified by:
        leftJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • leftJoin

        <P> JpaQuery<T> leftJoin​(com.querydsl.core.types.MapExpression<?,​P> target,
                                 com.querydsl.core.types.Path<P> alias)
        Specified by:
        leftJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • rightJoin

        <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.EntityPath<P> target)
        Specified by:
        rightJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • rightJoin

        <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.EntityPath<P> target,
                                  com.querydsl.core.types.Path<P> alias)
        Specified by:
        rightJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • rightJoin

        <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target)
        Specified by:
        rightJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • rightJoin

        <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.CollectionExpression<?,​P> target,
                                  com.querydsl.core.types.Path<P> alias)
        Specified by:
        rightJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • rightJoin

        <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.MapExpression<?,​P> target)
        Specified by:
        rightJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • rightJoin

        <P> JpaQuery<T> rightJoin​(com.querydsl.core.types.MapExpression<?,​P> target,
                                  com.querydsl.core.types.Path<P> alias)
        Specified by:
        rightJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • on

        JpaQuery<T> on​(com.querydsl.core.types.Predicate... condition)
        Specified by:
        on in interface com.querydsl.jpa.JPQLQuery<T>
      • fetchJoin

        JpaQuery<T> fetchJoin()
        Specified by:
        fetchJoin in interface com.querydsl.jpa.JPQLQuery<T>
      • fetchAll

        JpaQuery<T> fetchAll()
        Specified by:
        fetchAll in interface com.querydsl.jpa.JPQLQuery<T>
      • select

        <U> JpaQuery<U> select​(com.querydsl.core.types.Expression<U> expr)
        Specified by:
        select in interface com.querydsl.core.FetchableQuery<T,​com.querydsl.jpa.JPQLQuery<T>>
        Specified by:
        select in interface com.querydsl.jpa.JPQLQuery<T>
      • select

        JpaQuery<com.querydsl.core.Tuple> select​(com.querydsl.core.types.Expression<?>... exprs)
        Specified by:
        select in interface com.querydsl.core.FetchableQuery<T,​com.querydsl.jpa.JPQLQuery<T>>
        Specified by:
        select in interface com.querydsl.jpa.JPQLQuery<T>
      • setLockMode

        JpaQuery<T> setLockMode​(javax.persistence.LockModeType lockMode)
        Set the query LockModeType.
        Parameters:
        lockMode - Lock mode
        Returns:
        this
      • setFlushMode

        JpaQuery<T> setFlushMode​(javax.persistence.FlushModeType flushMode)
        Set the query FlushModeType.
        Parameters:
        flushMode - Flush mode
        Returns:
        this
      • setHint

        JpaQuery<T> setHint​(String name,
                            Object value)
        Add a query hint.
        Parameters:
        name - Query hint name
        value - Query hint value
        Returns:
        this
      • list

        default <RT> List<RT> list​(com.querydsl.core.types.Expression<RT> projection)
        Convenience method to execute the query and return results as List. An empty list is returned when no result is found.
        Type Parameters:
        RT - Result type
        Parameters:
        projection - Projection
        Returns:
        Query results List
      • singleResult

        default <RT> RT singleResult​(com.querydsl.core.types.Expression<RT> projection)
        Convenience method to execute the query and return a single result. For multiple results, only the first one is returned.
        Type Parameters:
        RT - Result type
        Parameters:
        projection - Projection
        Returns:
        The single (first) query result, null if no results available
      • uniqueResult

        default <RT> RT uniqueResult​(com.querydsl.core.types.Expression<RT> projection)
        Convenience method to execute the query and return the result, which is expected to be unique.
        Type Parameters:
        RT - Result type
        Parameters:
        projection - Projection
        Returns:
        The unique query result, null if no results available
        Throws:
        com.querydsl.core.NonUniqueResultException - if there is more than one result
      • count

        default long count()
        Shorter for count(*) on selected entity path.
        Returns:
        Count result