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();
}