Community
Participate
Working Groups
Build Identifier: The having clause of a CriteriaQuery is ignored in this simple query. The generated JPQL/SQL query does not contain the having clause. CriteriaQuery<Ecole> c = cb.createQuery(Ecole.class); Root<Ecole> ec = c.from(Ecole.class); Join<Ecole, Journee> j = ec.join("journeeCollection", JoinType.LEFT); Expression<Number> expDateLimiteInscrMax = cb.max(j.get("dateLimiteInscription").as(Number.class)); c.having(cb.ge(expDateLimiteInscrMax, 1234567890); The workaround is to use a multiselect query like this : CriteriaQuery<Object[]> c = cb.createQuery(Object[].class); Root<Ecole> ec = c.from(Ecole.class); Join<Ecole, Journee> j = ec.join("journeeCollection", JoinType.LEFT); Expression<Number> expDateLimiteInscrMax = cb.max(j.get("dateLimiteInscription").as(Number.class)); c.having(cb.ge(expDateLimiteInscrMax, 1234567890); c.multiselect(ec, cb.literal(1)).groupBy(ec); Reproducible: Always
Changing to Enhancement. See section 4.7 of the JPA 2.0 specification. It indicates that support of HAVING without GROUP BY is optional and non-portable.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink