svn commit: r672192 - /ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r672192 - /ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

jleroux@apache.org
Author: jleroux
Date: Fri Jun 27 01:43:36 2008
New Revision: 672192

URL: http://svn.apache.org/viewvc?rev=672192&view=rev
Log:
Applied fix from trunk for revision: 672191

Modified:
    ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Modified: ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=672192&r1=672191&r2=672192&view=diff
==============================================================================
--- ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/branches/release4.0/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Fri Jun 27 01:43:36 2008
@@ -995,7 +995,18 @@
             sqlP.executeQuery();
             long count = 0;
             ResultSet resultSet = sqlP.getResultSet();
-            if (resultSet.next()) {
+            boolean isGroupBy = false;
+            if (modelEntity instanceof ModelViewEntity) {
+              ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity;
+              String groupByString = modelViewEntity.colNameString(modelViewEntity.getGroupBysCopy(), ", ", "", false);
+
+              if (UtilValidate.isNotEmpty(groupByString)) isGroupBy = true;
+            }
+
+            if (isGroupBy) {
+              while (resultSet.next()) count++;
+            }
+            else if (resultSet.next()) {
                 count = resultSet.getLong(1);
             }
             return count;