Package javax.persistence.criteria

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


      cq.where(condition);
      cq.distinct(asc);
      if (asc) {
        cq.orderBy(cb.asc(c.get(orderby)));
      } else {
        cq.orderBy(cb.desc(c.get(orderby)));
      }
      TypedQuery<Room> q = em.createQuery(cq);
      q.setFirstResult(start);
      q.setMaxResults(max);
      List<Room> ll = q.getResultList();
View Full Code Here


      cq.where(condition, subCondition);
      cq.distinct(asc);
      if (asc) {
        cq.orderBy(cb.asc(c.get(orderby)));
      } else {
        cq.orderBy(cb.desc(c.get(orderby)));
      }
      TypedQuery<Room> q = em.createQuery(cq);
      q.setFirstResult(start);
      q.setMaxResults(max);
      List<Room> ll = q.getResultList();
View Full Code Here

        cq.where(condition);
        cq.distinct(asc);
        if (asc) {
          cq.orderBy(cb.asc(c.get(orderby)));
        } else {
          cq.orderBy(cb.desc(c.get(orderby)));
        }
        TypedQuery<User> q = em.createQuery(cq);
        q.setFirstResult(start);
        q.setMaxResults(max);
        List<User> ll = q.getResultList();
View Full Code Here

      cq.where(condition);
      cq.distinct(asc);
      if (asc){
        cq.orderBy(cb.asc(c.get(orderby)));
      } else {
        cq.orderBy(cb.desc(c.get(orderby)));
      }
      TypedQuery<LdapConfig> q = em.createQuery(cq);
      q.setFirstResult(start);
      q.setMaxResults(max);
      List<LdapConfig> ll = q.getResultList();
View Full Code Here

      cq.where(condition);
      cq.distinct(asc);
      if (asc) {
        cq.orderBy(cb.asc(c.get(orderby)));
      } else {
        cq.orderBy(cb.desc(c.get(orderby)));
      }
      TypedQuery<Configuration> q = em.createQuery(cq);
      q.setFirstResult(start);
      q.setMaxResults(max);
      List<Configuration> ll = q.getResultList();
View Full Code Here

        if (end != null) {
            Predicate before = builder.lessThan(activity.<Date>get(AT), end);
            where = builder.and(where, before);
        }
        cq.where(where);
        cq.orderBy(builder.desc(activity.get(AT)));
        return em().createQuery(cq).getResultList();
    }

    /**
     * Recent dates of Link-IT activity by given member in desc order
View Full Code Here

        if (providers != null && !providers.isEmpty()) {
            cq.where(givenMember, chosenProviders, important);
        } else {
            cq.where(givenMember, important);
        }
        cq.orderBy(builder.desc(activity.get(AT)));
        return em().createQuery(cq).setFirstResult((page-1) * length).setMaxResults(length).getResultList();

    }

    /**
 
View Full Code Here

            if (providers != null && !providers.isEmpty()) {
                cq.where(linkedMembers, chosenProviders, important);
            } else {
                cq.where(linkedMembers, important);
            }
            cq.orderBy(builder.desc(activity.get(AT)));
            activities = em().createQuery(cq).setFirstResult((page-1) * length).setMaxResults(length).getResultList();
        }
        return activities;
    }

View Full Code Here

                Predicate before = builder.lessThan(activity.<Date>get(AT), end);
                where = builder.and(where, before);
            }
            where = builder.and(where, builder.le(activity.<Integer>get(LEVEL), 2));
            cq.where(where);
            cq.orderBy(builder.desc(activity.get(AT)));
            activities = em().createQuery(cq).getResultList();
        }
        return activities;
    }
View Full Code Here

        // Check for multi column select
        CriteriaQuery<Person> personQuery = criteriaBuilder.createQuery(Person.class);
        Root<Person> from = personQuery.from(Person.class);
        personQuery.select(from.alias("p"));
        personQuery.orderBy(criteriaBuilder.desc(from.get("personName")));
        String actual = CriteriaQueryTranslator.translate(personQuery);
        Assert.assertEquals(expected.trim(), actual.trim());
    }
   
    @Test
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.