You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/12/05 05:41:43 UTC

svn commit: r1042281 - /ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Author: lektran
Date: Sun Dec  5 04:41:42 2010
New Revision: 1042281

URL: http://svn.apache.org/viewvc?rev=1042281&view=rev
Log:
Merged from trunk r1042280:
In GenericDAO.selectListIteratorByCondition(...) the order of the select fields wasn't being maintained.  This causes problems later on if the EntityListIterator needs to perform a count query where the select field ordering is important for distinct queries (particularly for the likes of postgres which doesn't support SELECT COUNT(DISTINCT *) which can result if the first field is an aggregate).

Modified:
    ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Modified: ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1042281&r1=1042280&r2=1042281&view=diff
==============================================================================
--- ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/branches/release10.04/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun Dec  5 04:41:42 2010
@@ -645,12 +645,13 @@ public class GenericDAO {
         if (UtilValidate.isNotEmpty(fieldsToSelect)) {
             Set<String> tempKeys = FastSet.newInstance();
             tempKeys.addAll(fieldsToSelect);
-            Iterator<ModelField> fieldIter = modelEntity.getFieldsIterator();
-            while (fieldIter.hasNext()) {
-                ModelField curField = fieldIter.next();
-                if (tempKeys.contains(curField.getName())) {
-                    selectFields.add(curField);
-                    tempKeys.remove(curField.getName());
+            for (String fieldToSelect : fieldsToSelect) {
+                if (tempKeys.contains(fieldToSelect)) {
+                    ModelField curField = modelEntity.getField(fieldToSelect);
+                    if (curField != null) {
+                        selectFields.add(curField);
+                        tempKeys.remove(fieldToSelect);
+                    }
                 }
             }