Package javax.persistence.criteria

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


    Root<Customer> customerRoot = criteria.from( Customer.class );
    Join<Customer, Order> orderJoin = customerRoot.join( Customer_.orders );
    criteria.select( customerRoot );
    Subquery<Double> subCriteria = criteria.subquery( Double.class );
    Root<Order> subqueryOrderRoot = subCriteria.from( Order.class );
    subCriteria.select( builder.min( subqueryOrderRoot.get( Order_.totalPrice ) ) );
    criteria.where( builder.equal( orderJoin.get( "totalPrice" ), builder.all( subCriteria ) ) );
    em.createQuery( criteria ).getResultList();

    em.getTransaction().commit();
    em.close();
View Full Code Here


        switch (at) {
        case MAX:
            exp = cb.max(path);
            break;
        case MIN:
            exp = cb.min(path);
            break;
        case SUM:
            exp = cb.sum(path);
            break;
        }
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.