Package javax.persistence.criteria

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


        // Get results using Tuple
        CriteriaBuilder qb = em.getCriteriaBuilder();
        CriteriaQuery<Tuple> criteriaQuery = qb.createTupleQuery();
        Root<Order> order = criteriaQuery.from(Order.class);
        Join<Item, Producer> producer = order.join(Order_.items).join(Item_.producer);
        criteriaQuery.select(qb.tuple(order, producer));
        criteriaQuery.where(qb.equal(order.get(Order_.filled), Boolean.TRUE));
        TypedQuery<Tuple> eq = em.createQuery(criteriaQuery);
        List<Tuple> criteriaResults = eq.getResultList();

        // Get results using custom class
View Full Code Here


        Predicate whereClause = cb.and(cb.lessThanOrEqualTo(requestDate, to), cb.greaterThanOrEqualTo(requestDate, from));
        if (spec != null) {
            whereClause = cb.and(whereClause, spec.toPredicate(requestRoot, cbQuery, cb));
        }
        final CompoundSelection<Tuple> selection = cb.tuple(requestDateByType, cb.count(requestRoot));
        cbQuery.select(selection)
                .where(whereClause)
                .groupBy(requestDateByType)
                .orderBy(cb.desc(requestDateByType));
View Full Code Here

                break;
            default:
                throw new IllegalArgumentException("Not a valid value: " + direction);
        }

        query.select(cb.tuple(path, cb.count(root)))
                .where(predicate)
                .groupBy(path)
                .orderBy(order);

        return Lists.transform(_EntityManager.createQuery(query).getResultList(), new Function<Tuple, Pair<T, Integer>>() {
View Full Code Here

        // Get results using Tuple
        CriteriaBuilder qb = em.getCriteriaBuilder();
        CriteriaQuery<Tuple> criteriaQuery = qb.createTupleQuery();
        Root<Order> order = criteriaQuery.from(Order.class);
        Join<Item, Producer> producer = order.join(Order_.items).join(Item_.producer);
        criteriaQuery.select(qb.tuple(order, producer));
        criteriaQuery.where(qb.equal(order.get(Order_.filled), Boolean.TRUE));
        TypedQuery<Tuple> eq = em.createQuery(criteriaQuery);
        List<Tuple> criteriaResults = eq.getResultList();

        // Get results using custom class
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.