Class JpaUtils.CriteriaQuery<E,​R>

  • Enclosing class:
    JpaUtils

    public abstract static class JpaUtils.CriteriaQuery<E,​R>
    extends Object
    Creates a CriteriaQuery wrapper that initialises commonly used JPA variables. You can customise the query through apply() and run it with one of the getXXX methods.
    • Field Detail

      • cb

        protected final javax.persistence.criteria.CriteriaBuilder cb
      • q

        protected final javax.persistence.criteria.CriteriaQuery<R> q
      • entity

        protected final javax.persistence.criteria.Root<? extends E> entity
    • Constructor Detail

      • CriteriaQuery

        public CriteriaQuery​(org.hibernate.SessionFactory sessionFactory,
                             Class<? extends E> entity,
                             Class<R> result)
    • Method Detail

      • apply

        protected abstract void apply()
      • getSingleResult

        public R getSingleResult()
        See Also:
        TypedQuery.getSingleResult()
      • uniqueResult

        public R uniqueResult()
      • getResultList

        public List<R> getResultList()
        See Also:
        TypedQuery.getResultList()
      • getResultList

        public List<R> getResultList​(int firstResult,
                                     int maxResults)
        See Also:
        TypedQuery.setFirstResult(int), TypedQuery.setMaxResults(int), TypedQuery.getResultList()