for (KeyedReference elem : categories) {
List<KeyedReference> keyedRefs = new ArrayList<KeyedReference>(0);
if (elem instanceof KeyedReference)
keyedRefs.add((KeyedReference)elem);
DynamicQuery dynamicQry = new DynamicQuery(queryOne.toString());
currentAlias = entityAliasChild;
joinClause = entityAlias + "." + keyName + " = "
+ entityAliasChild + "." + entityField + "." + keyName + " ";
appendConditions(dynamicQry, fq, keyedRefs);
if (restrictions != null && restrictions.length > 0)
dynamicQry.AND().pad().appendGroupedAnd(restrictions);
if (keyedRefs.size() != 0) {
List list = getQueryResult(em, dynamicQry, keysIn, entityAlias + "." + keyName);
aggregatedResultsOne.addAll(list);
}
}
queryTwo.append("select " + entityAlias + "." + keyName + ", " + entityAliasChild2 + ".id "
+ "from " + entityName + " " + entityAlias + ", " + entityNameChild + " " + entityAliasChild + ", "
+ entityNameChild2 + " " + entityAliasChild2 + " ");
for (KeyedReference elem : categories) {
List<KeyedReference> keyedRefs = new ArrayList<KeyedReference>(0);
if (elem instanceof KeyedReference)
keyedRefs.add((KeyedReference)elem);
DynamicQuery dynamicQry = new DynamicQuery(queryTwo.toString());
currentAlias = entityAliasChild2;
if (BusinessEntityQuery.ENTITY_NAME.equals(entityName)) {
joinClause = entityAlias + ".entityKey" + " = "
+ entityAliasChild + "." + entityField + ".entityKey" + " and "
+ entityAliasChild + "." + entityField + ".entityKey" + " = "
+ entityAliasChild2 + ".businessService.businessEntity.entityKey";
} else {
joinClause = entityAlias + ".entityKey" + " = "
+ entityAliasChild + "." + entityField + ".entityKey" + " and "
+ entityAliasChild + "." + entityField + ".entityKey" + " = "
+ entityAliasChild2 + ".bindingTemplate.businessService.entityKey";
}
appendConditions(dynamicQry, fq, keyedRefs);
if (restrictions != null && restrictions.length > 0)
dynamicQry.AND().pad().appendGroupedAnd(restrictions);
if (keyedRefs.size() != 0) {
List list = getQueryResult(em, dynamicQry, keysIn, entityAlias + "." + keyName);
aggregatedResultsTwo.addAll(list);
}