Fix orders filtered query

GROUP BY clause was being added in the middle of the query instead of at the
end.

FEA: ItEr77S15FilteringEnhancements
This commit is contained in:
Manuel Rego Casasnovas 2013-02-20 13:54:34 +01:00 committed by Lorenzo Tilve Álvaro
parent fb243cc5d5
commit dbf3f0883a

View file

@ -352,6 +352,7 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
strQuery += "FROM Order o ";
String where = "";
String whereFinal = "";
if (labels != null && !labels.isEmpty()) {
for (int i = 0; i < labels.size(); i++) {
if (where.isEmpty()) {
@ -372,8 +373,8 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
}
where += "cr.criterion IN (:criteria) ";
where += "AND cr.class = DirectCriterionRequirement ";
where += "GROUP BY o.id ";
where += "HAVING count(o.id) = :criteriaSize ";
whereFinal += "GROUP BY o.id ";
whereFinal += "HAVING count(o.id) = :criteriaSize ";
}
if (customer != null) {
@ -409,8 +410,7 @@ public class OrderDAO extends IntegrationEntityDAO<Order> implements
where += "o.id IN (:ids) ";
}
strQuery += where;
strQuery += where + whereFinal;
Query query = getSession().createQuery(strQuery);
if (labels != null && !labels.isEmpty()) {
int i = 0;