| Summary: | CriteriaBuilder having clause is ignored | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Patrice Lachance <patrice.lachance> |
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | j.edward.rayl, tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
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 |
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