/** * JPQL allows count([distinct] e), where e can be an object, not just a single field, * however the database only allows a single field, so object needs to be translated to a single field. * If the descriptor has a single pk, it is used, otherwise any pk is used if distinct, otherwise a subselect is used. * If the object was obtained through an outer join, then the subselect also will not work, so an error is thrown. */ private void prepareObjectAttributeCount(List<ReportItem> items, Map clonedExpressions) { int numOfReportItems = items.size(); //gf675: need to loop through all items to fix all count(..) instances for (int i =0;i<numOfReportItems; i++){ ReportItem item = items.get(i); if (item == null) { continue; } else if (item instanceof ConstructorReportItem) { // recursive call to process child ReportItems prepareObjectAttributeCount(((ConstructorReportItem)item).getReportItems(), clonedExpressions); } else if (item.getAttributeExpression() instanceof FunctionExpression) { FunctionExpression count = (FunctionExpression)item.getAttributeExpression(); count.prepareObjectAttributeCount(null, item, this, clonedExpressions); } } }
/** * JPQL allows count([distinct] e), where e can be an object, not just a single field, * however the database only allows a single field, so object needs to be translated to a single field. * If the descriptor has a single pk, it is used, otherwise any pk is used if distinct, otherwise a subselect is used. * If the object was obtained through an outer join, then the subselect also will not work, so an error is thrown. */ private void prepareObjectAttributeCount(List items, Map clonedExpressions) { int numOfReportItems = items.size(); //gf675: need to loop through all items to fix all count(..) instances for (int i =0;i<numOfReportItems; i++){ ReportItem item = (ReportItem)items.get(i); if (item == null) { continue; } else if (item instanceof ConstructorReportItem) { // recursive call to process child ReportItems prepareObjectAttributeCount(((ConstructorReportItem)item).getReportItems(), clonedExpressions); } else if (item.getAttributeExpression() instanceof FunctionExpression) { FunctionExpression count = (FunctionExpression)item.getAttributeExpression(); count.prepareObjectAttributeCount(null, item, this, clonedExpressions); } } }
prepareObjectAttributeCount(normalizer, null, null, null);
prepareObjectAttributeCount(normalizer, null, null, null);