Criteria critMain = new Criteria();
Criteria critSub = new Criteria();
critSub.addEqualTo("articleName", name);
ReportQueryByCriteria querySub = QueryFactory.newReportQuery(Article.class, critSub);
querySub.setAttributes(new String[]{"productGroupId"});
Iterator subIter = broker.getReportQueryIteratorByQuery(querySub);
Collection subIds = new ArrayList();
while(subIter.hasNext())
{
Object[] id = (Object[]) subIter.next();
subIds.add(id[0]);
}
ReportQueryByCriteria queryMain = QueryFactory.newReportQuery(AbstractProductGroup.class, critMain);
queryMain.setAttributes(new String[]{"groupId", "groupName"});
critMain.addIn("groupId", subIds);
Iterator iter = broker.getReportQueryIteratorByQuery(queryMain);
int result = 0;
assertNotNull(iter);