diff --git a/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java b/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java index e81c3855d1..ead4733e1d 100644 --- a/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java +++ b/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java @@ -42,6 +42,7 @@ import org.ofbiz.sql.NumberValue; import org.ofbiz.sql.OrderByItem; import org.ofbiz.sql.Planner; import org.ofbiz.sql.Relation; +import org.ofbiz.sql.SelectGroup; import org.ofbiz.sql.SQLDelete; import org.ofbiz.sql.SQLInsert; import org.ofbiz.sql.SQLSelect; @@ -51,6 +52,7 @@ import org.ofbiz.sql.StaticValue; import org.ofbiz.sql.StringValue; import org.ofbiz.sql.Table; import org.ofbiz.sql.TableName; +import org.ofbiz.sql.Unioned; import org.ofbiz.sql.Value; public class EntityPlanner extends Planner { @@ -68,20 +70,25 @@ public class EntityPlanner extends Planner groupBy = selectStatement.getGroupBy(); + List groupBy = selectGroup.getGroupBy(); if (groupBy == null) { groupBy = Collections.emptyList(); } - for (FieldDef fieldDef: selectStatement.getFieldDefs()) { + for (FieldDef fieldDef: selectGroup.getFieldDefs()) { addFieldDef(dve, groupBy, fieldDef.getAlias(), fieldDef); } List orderBy; @@ -93,7 +100,7 @@ public class EntityPlanner extends Planner | | -// | + | + | + | + | | | | @@ -299,7 +302,51 @@ private SQLView View(): { name=NamePart() sqlSelect=Select() { return new SQLView(name, sqlSelect); } } +private SelectGroup SelectGroup(): { + boolean isDistinct = false; + List groupBy = null; + Map fieldDefs = FastMap.newInstance(); + List fieldAlls = FastList.newInstance(); + Set fieldAllAliases = FastSet.newInstance(); + Table table; + Condition whereCondition = null, havingCondition = null; +} { +