Fix a Group By bug when using Count (View Entities)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@672191 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -970,7 +970,18 @@ public class GenericDAO {
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user