Skip to content
Browse files
Fixed: Incorrect findByCount on DynamicView with groupBy and selected…
… fields


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: 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
nmalin committed May 17, 2019
1 parent cce437f commit c96585018e8f86d7ee5c0cc34878b376f6bc6dbb
Showing with 1 addition and 1 deletion.
  1. +1 −1 framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/
@@ -1031,7 +1031,7 @@ public long selectCountByCondition(Delegator delegator, ModelEntity modelEntity,

// 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

0 comments on commit c965850

Please sign in to comment.