Package javax.persistence.criteria

Examples of javax.persistence.criteria.CriteriaBuilder.desc()


        if (customer != null) {
            predicates.add(cb.equal(order.get(PurchaseOrder_.customer), customer));
        }
        if (!predicates.isEmpty())
            q.where(predicates.toArray(new Predicate[predicates.size()]));
        q.orderBy(cb.desc(order.get(PurchaseOrder_.placedOn)));
       
        TypedQuery<PurchaseOrder> query = em.createQuery(q);
        List<PurchaseOrder> result = query.getResultList();
        commit();
        return result;
View Full Code Here


    Path titleField = candidate.get("title");
    cq.where(cb.equal(titleField, "Bar Book"));

    Path isbnField = candidate.get("isbn");
    cq.orderBy(cb.desc(isbnField));

    Query q = em.createQuery(cq);
    List<Book> books = q.getResultList();
    assertNotNull(books);
    assertEquals(2, books.size());
View Full Code Here

        } else {
            cq.where(cb.and(whereState, cb.or(whereCreatedBy, whereCreatedByOrg)));
        }
       
       
        cq.orderBy(cb.desc(z.get(Request_.id)));
        cq.select(z);

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

            cq.where(whereState);
        } else {
            cq.where(cb.and(whereState, wherePerfomer));
        }

        cq.orderBy(cb.desc(z.get(Request_.id)));
        cq.select(z);

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

        cq.where(cb.and(
                    cb.isNotNull(z.get(Request_.serviceObject)),
                    cb.equal(z.get(Request_.serviceObject), current.getServiceObject()))
                );
               
        cq.orderBy(cb.desc(z.get(Request_.id)));
        cq.select(z);

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

        } else {
            cq.where(cb.and(where, whereCreatedByOrg));    
        }
  
           
        cq.orderBy(cb.desc(z.get(Request_.id)));
        cq.select(z);

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

        }
        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.where((value != null) ? criteriaBuilder.equal(beanRoot.get(name), value) : criteriaBuilder.isNull(beanRoot.get(name)));
            }
            if (orderBy != null)
            {
                criteriaQuery.orderBy(ascending ? criteriaBuilder.asc(beanRoot.get(orderBy)) : criteriaBuilder.desc(beanRoot.get(orderBy)));
            }
           
            // invoke query
            Query query = entityManager.createQuery(criteriaQuery);
            List<? extends IBean> beansList = query.getResultList();
View Full Code Here

                }
                criteriaQuery.where(predicate);
            }
            if (orderBy != null)
            {
                criteriaQuery.orderBy(ascending ? criteriaBuilder.asc(beanRoot.get(orderBy)) : criteriaBuilder.desc(beanRoot.get(orderBy)));
            }
           
            // invoke query
            Query query = entityManager.createQuery(criteriaQuery);
            List<? extends IBean> beansList = query.getResultList();
View Full Code Here

        if (customer != null) {
            predicates.add(cb.equal(order.get(PurchaseOrder_.customer), customer));
        }
        if (!predicates.isEmpty())
            q.where(predicates.toArray(new Predicate[predicates.size()]));
        q.orderBy(cb.desc(order.get(PurchaseOrder_.placedOn)));
       
        TypedQuery<PurchaseOrder> query = em.createQuery(q);
        List<PurchaseOrder> result = query.getResultList();
        commit();
        return result;
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.