public void iterate(Expression expression) { if (expression.isQueryKeyExpression() && ((QueryKeyExpression)expression).shouldQueryToManyRelationship()) { // Aggregate should only use distinct as specified by the user. if (!isDistinctComputed()) { useDistinct(); } } } };
@Override public void iterate(Expression expression) { if (expression.isQueryKeyExpression() && ((QueryKeyExpression)expression).shouldQueryToManyRelationship()) { // Aggregate should only use distinct as specified by the user. if (!isDistinctComputed()) { useDistinct(); } } } };
public void iterate(Expression expression) { if (expression.isQueryKeyExpression() && ((QueryKeyExpression)expression).shouldQueryToManyRelationship()) { // Aggregate should only use distinct as specified by the user. if (!isDistinctComputed()) { useDistinct(); } } } };
/** * INTERNAL: * Return a select statement that will be used to query the class indicators required to query. * This is used in the abstract-multiple read. */ public SQLSelectStatement buildClassIndicatorSelectStatement(ObjectLevelReadQuery query) { SQLSelectStatement selectStatement; selectStatement = new SQLSelectStatement(); selectStatement.useDistinct(); selectStatement.addTable(classIndicatorField.getTable()); selectStatement.addField(getClassIndicatorField()); // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); selectStatement.setWhereClause(((ExpressionQueryMechanism)query.getQueryMechanism()).buildBaseSelectionCriteria(false, clonedExpressions)); appendWithAllSubclassesExpression(selectStatement); selectStatement.setTranslationRow(query.getTranslationRow()); if (query.isReadAllQuery() && ((ReadAllQuery)query).hasHierarchicalExpressions()) { ReadAllQuery readAllQuery = (ReadAllQuery)query; selectStatement.setHierarchicalQueryExpressions(readAllQuery.getStartWithExpression(), readAllQuery.getConnectByExpression(), readAllQuery.getOrderSiblingsByExpressions()); } selectStatement.setHintString(query.getHintString()); selectStatement.normalize(query.getSession(), getDescriptor(), clonedExpressions); return selectStatement; }
/** * INTERNAL: * Return a select statement that will be used to query the class indicators required to query. * This is used in the abstract-multiple read. */ public SQLSelectStatement buildClassIndicatorSelectStatement(ObjectLevelReadQuery query) { SQLSelectStatement selectStatement; selectStatement = new SQLSelectStatement(); selectStatement.useDistinct(); selectStatement.addTable(classIndicatorField.getTable()); selectStatement.addField(getClassIndicatorField()); // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); selectStatement.setWhereClause(((ExpressionQueryMechanism)query.getQueryMechanism()).buildBaseSelectionCriteria(false, clonedExpressions)); appendWithAllSubclassesExpression(selectStatement); selectStatement.setTranslationRow(query.getTranslationRow()); if (query.isReadAllQuery() && ((ReadAllQuery)query).hasHierarchicalExpressions()) { ReadAllQuery readAllQuery = (ReadAllQuery)query; selectStatement.setHierarchicalQueryExpressions(readAllQuery.getStartWithExpression(), readAllQuery.getConnectByExpression(), readAllQuery.getOrderSiblingsByExpressions(), readAllQuery.getDirection()); } selectStatement.setHintString(query.getHintString()); selectStatement.normalize(query.getSession(), getDescriptor(), clonedExpressions); return selectStatement; }
/** * INTERNAL: * Return a select statement that will be used to query the class indicators required to query. * This is used in the abstract-multiple read. */ public SQLSelectStatement buildClassIndicatorSelectStatement(ObjectLevelReadQuery query) { SQLSelectStatement selectStatement; selectStatement = new SQLSelectStatement(); selectStatement.useDistinct(); selectStatement.addTable(classIndicatorField.getTable()); selectStatement.addField(getClassIndicatorField()); // 2612538 - the default size of Map (32) is appropriate Map clonedExpressions = new IdentityHashMap(); selectStatement.setWhereClause(((ExpressionQueryMechanism)query.getQueryMechanism()).buildBaseSelectionCriteria(false, clonedExpressions)); appendWithAllSubclassesExpression(selectStatement); selectStatement.setTranslationRow(query.getTranslationRow()); if (query.isReadAllQuery() && ((ReadAllQuery)query).hasHierarchicalExpressions()) { ReadAllQuery readAllQuery = (ReadAllQuery)query; selectStatement.setHierarchicalQueryExpressions(readAllQuery.getStartWithExpression(), readAllQuery.getConnectByExpression(), readAllQuery.getOrderSiblingsByExpressions(), readAllQuery.getDirection()); } selectStatement.setHintString(query.getHintString()); selectStatement.normalize(query.getSession(), getDescriptor(), clonedExpressions); return selectStatement; }
normalizer.getStatement().useDistinct();