Package javax.persistence.criteria

Examples of javax.persistence.criteria.CriteriaQuery.orderBy()


        }
        CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
        CriteriaQuery cq = cb.createQuery();
        Root<HistoryRequest> h = cq.from(HistoryRequest.class);
        cq.where(cb.equal(h.get(HistoryRequest_.request), request));
        cq.orderBy(cb.desc(h.get(HistoryRequest_.modifiedDate)));
       
        cq.select(h);

        return em.createQuery(cq).getResultList();
    }
View Full Code Here


        CriteriaQuery cq = cb.createQuery();
        Root<ServiceObject> s = cq.from(ServiceObject.class);
       
        cq.where(cb.equal(s.get(ServiceObject_.organization), curUser.getOrganization()));
       
        cq.orderBy(cb.asc(s.get(ServiceObject_.id)));
        cq.select(s);
       
        return getEntityManager().createQuery(cq).getResultList();

       
View Full Code Here

                from.get("revision"), from.get("parent"), from.get("domainId"), from.get("connectorId"),
                from.get("instanceId"));

            Predicate[] predicates = convertCommitRequestToPredicates(criteriaBuilder, from, request);
            query.where(criteriaBuilder.and(predicates));
            query.orderBy(criteriaBuilder.asc(from.get("timestamp")));
            TypedQuery<Object[]> typedQuery = entityManager.createQuery(query);
            List<CommitMetaInfo> infos = new ArrayList<>();
            for (Object[] row : typedQuery.getResultList()) {
                CommitMetaInfo info = new CommitMetaInfo();
                info.setCommitter(row[0] != null ? row[0].toString() : null);
View Full Code Here

      for (Iterator it = query.getOrderings(); it.hasNext();)
      {
        PersistenceOrdering ordering = (PersistenceOrdering) it.next();

        if (ordering.isAscending())
          cq.orderBy(cb.asc(entity.get(ordering.getPropertyName())));
        else
          cq.orderBy(cb.desc(entity.get(ordering.getPropertyName())));
      }
      // cq.where(cb.equal(entity.get(Order_.orderNumber), orderNumber));
View Full Code Here

        PersistenceOrdering ordering = (PersistenceOrdering) it.next();

        if (ordering.isAscending())
          cq.orderBy(cb.asc(entity.get(ordering.getPropertyName())));
        else
          cq.orderBy(cb.desc(entity.get(ordering.getPropertyName())));
      }
      // cq.where(cb.equal(entity.get(Order_.orderNumber), orderNumber));

      for (Iterator it = query.getCriterions(); it.hasNext();)
      {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.