Class CriteriaApiHelper.SelectCtx<QT>

  • Type Parameters:
    QT - the query type.
    Enclosing class:
    CriteriaApiHelper

    public static final class CriteriaApiHelper.SelectCtx<QT>
    extends Object
    Wraps the EntityManager provided by the entity context, a CriteriaBuilder and a CriteriaQuery. This can replace the well-known three-liner
    
      EntityManager em = ec.getEm();
      CriteriaBuilder cb = em.getCriteriaBuilder();
      CriteriaQuery<XyzEntity> cq = cb.createQuery(XyzEntity.class);
     
    by
    
      SelectCtx<XyzEntity> ctx = CriteriaApiHelper.selectCtx(ec);
     
    • Field Detail

      • cq

        public final javax.persistence.criteria.CriteriaQuery<QT> cq
        The CriteriaQuery instance.
    • Method Detail

      • createQuery

        public javax.persistence.TypedQuery<QT> createQuery()
        Creates a TypedQuery instance for executing a criteria query, does the same as ctx.em.createQuery(ctx.cq).
        Returns:
        the resulting TypedQuery