From 1fb06865a1834b7c0f4e559f1b00f4d8e8c17f2c Mon Sep 17 00:00:00 2001 From: Nicolas Malin Date: Fri, 17 May 2019 15:48:46 +0000 Subject: [PATCH] Fixed: Backport: Incorrect findByCount on DynamicView with groupBy and selected fields (OFBIZ-11041) When you create a DynamicView with 'group by' agreggate function and you perform a delegator.findCountByCondition() with selected fields, the result is different from the count of each element returned by delegator.findList(). The problem come from when the 'group by' closure is populated with all grouped by fields from on the DV and not only those from selected fields. Thanks to Leila Mekika to raise and solve this issue. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release18.12@1859439 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/ofbiz/entity/datasource/GenericDAO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java index 7950e4b537..e79c0bdcf4 100644 --- a/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java +++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java @@ -1031,7 +1031,7 @@ public class GenericDAO { // GROUP BY clause for view-entity if (isGroupBy) { - modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(), sqlBuffer, " GROUP BY ", ", ", "", false); + modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(selectFields), sqlBuffer, " GROUP BY ", ", ", "", false); } // HAVING clause