You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2013/06/09 12:04:16 UTC

svn commit: r1491170 - /ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Author: adrianc
Date: Sun Jun  9 10:04:15 2013
New Revision: 1491170

URL: http://svn.apache.org/r1491170
Log:
Reverting rev 1486552:

https://issues.apache.org/jira/browse/OFBIZ-5214

Modified:
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1491170&r1=1491169&r2=1491170&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun Jun  9 10:04:15 2013
@@ -708,6 +708,8 @@ public class GenericDAO {
                     Debug.logInfo("[" + modelEntity.getEntityName() + "]: auto-added field-sets: " + reasonSets, module);
                 }
             }
+        } else {
+            selectFields = modelEntity.getFieldsUnmodifiable();
         }
 
         StringBuilder sqlBuffer = new StringBuilder("SELECT ");
@@ -716,23 +718,10 @@ public class GenericDAO {
             sqlBuffer.append("DISTINCT ");
         }
 
-        if (modelEntity instanceof ModelViewEntity) {
-            // Views must have enumerated fields in SELECT.
-            if (selectFields.isEmpty()) {
-                modelEntity.colNameString(modelEntity.getFieldsUnmodifiable(), sqlBuffer, "", ", ", "", datasource.getAliasViewColumns());
-            } else {
-                modelEntity.colNameString(selectFields, sqlBuffer, "", ", ", "", datasource.getAliasViewColumns());
-            }
+        if (selectFields.size() > 0) {
+            modelEntity.colNameString(selectFields, sqlBuffer, "", ", ", "", datasource.getAliasViewColumns());
         } else {
-            if (selectFields.isEmpty()) {
-                sqlBuffer.append("*");
-            } else {
-                modelEntity.colNameString(selectFields, sqlBuffer, "", ", ", "", datasource.getAliasViewColumns());
-            }
-        }
-        if (selectFields.isEmpty()) {
-            // The code that follows must have a non-empty list.
-            selectFields = modelEntity.getFieldsUnmodifiable();
+            sqlBuffer.append("*");
         }
 
         // populate the info from entity-condition in the view-entity, if it is one and there is one