Class JPAQueryBuilder<T,ID>

java.lang.Object
com.peterphi.std.guice.hibernate.webquery.impl.jpa.JPAQueryBuilder<T,ID>
All Implemented Interfaces:
JPAQueryBuilderInternal

public class JPAQueryBuilder<T,ID> extends Object implements JPAQueryBuilderInternal
  • Constructor Details

    • JPAQueryBuilder

      public JPAQueryBuilder(org.hibernate.Session session, QEntity entity)
  • Method Details

    • addConstraints

      public void addConstraints(javax.persistence.criteria.Predicate... predicates)
      Description copied from interface: JPAQueryBuilderInternal
      Add new Predicates which will be ANDed together with the top-level constraints specified in the WebQuery
      Specified by:
      addConstraints in interface JPAQueryBuilderInternal
      Parameters:
      predicates - the predicate(s) to add
    • addConstraints

      public void addConstraints(List<WQConstraintLine> constraints)
      Description copied from interface: JPAQueryBuilderInternal
      Add new constraints as if they'd been defined at the top level of the WebQuery (N.B. will be ANDed together with all other constraints
      Specified by:
      addConstraints in interface JPAQueryBuilderInternal
    • getProperty

      public javax.persistence.criteria.Expression<?> getProperty(String path)
    • getProperty

      public javax.persistence.criteria.Expression<?> getProperty(WQPath path)
      Get a property, automatically creating any joins along the way as needed
      Specified by:
      getProperty in interface JPAQueryBuilderInternal
      Parameters:
      path -
      Returns:
    • getOrCreateJoin

      public JPAJoin getOrCreateJoin(WQPath path)
      Ensure a join has been set up for a path
      Specified by:
      getOrCreateJoin in interface JPAQueryBuilderInternal
      Parameters:
      path -
      Returns:
    • forWebQuery

      public void forWebQuery(WebQuery query)
    • forIDs

      public void forIDs(WebQuery original, List<?> ids)
    • selectCount

      public Long selectCount()
    • selectIDs

      public <ID> List<ID> selectIDs()
    • selectCustomProjection

      public List<Object[]> selectCustomProjection(String... fields)
    • selectEntity

      public List<T> selectEntity()
    • createSelectCount

      public org.hibernate.query.Query<Long> createSelectCount()
    • selectCustom

      public <C> List<C> selectCustom(JPAQueryCustomiser customiser)
    • createSelectCustom

      public <C> org.hibernate.query.Query<C> createSelectCustom(JPAQueryCustomiser customiser)
    • createSelectCustomProjection

      public org.hibernate.query.Query createSelectCustomProjection(String... fields)
    • createSelectIDs

      public org.hibernate.query.Query createSelectIDs()
    • createSelectEntity

      public org.hibernate.query.Query<T> createSelectEntity()
    • applyFetches

      public void applyFetches()
      Description copied from interface: JPAQueryBuilderInternal
      Set up fetch joins as specified by the dbfetch/expand/default EAGER fetch annotations
      Specified by:
      applyFetches in interface JPAQueryBuilderInternal
    • hasCollectionJoin

      public boolean hasCollectionJoin()
      Returns true if one of the non-fetch joins specified will result in a collection being pulled back
      Returns:
    • hasCollectionFetch

      public boolean hasCollectionFetch()
      Returns true if one of the fetches specified will result in a collection being pulled back
    • offset

      public void offset(int offset)
    • limit

      public void limit(int limit)