private CriteriaQuery<Double> buildAvgCriteriaQuery(EntityManager em,
Class<Double> type, SingularAttribute<AggEntity, Double> sa) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Double> cq = cb.createQuery(type);
Root<AggEntity> aer = cq.from(AggEntity.class);
return cq.select(cb.avg(aer.get(sa)));
}
private void verifyResult(EntityManager em, String[] aggregates,
String[] attributes, boolean expectNull) {
verifyResult(em, aggregates, attributes, expectNull, false);