Author: nmalin
Date: Fri May 17 15:48:46 2019
New Revision: 1859439
URL:
http://svn.apache.org/viewvc?rev=1859439&view=revLog:
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.
Modified:
ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
Modified: ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java?rev=1859439&r1=1859438&r2=1859439&view=diff==============================================================================
--- ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/ofbiz-framework/branches/release18.12/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java Fri May 17 15:48:46 2019
@@ -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