Class CriteriaApiHelper.UpdateCtx<QT>

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

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

      • cu

        public final javax.persistence.criteria.CriteriaUpdate<QT> cu
        The CriteriaUpdate instance.
    • Method Detail

      • createQuery

        public javax.persistence.Query createQuery()
        Creates a Query instance for executing a criteria update query, does the same as ctx.em.createQuery(ctx.cu).
        Returns:
        the resulting Query