Author: nmalin
Date: Fri May 17 15:45:07 2019
New Revision: 1859438

URL: http://svn.apache.org/viewvc?rev=1859438&view=rev
Log:
Fixed: 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/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java

Modified: 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java?rev=1859438&r1=1859437&r2=1859438&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/datasource/GenericDAO.java
 Fri May 17 15:45:07 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


Reply via email to