/** * ADVANCED: * Return an expression representing traversal of a 1:many or many:many relationship. * This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria. * <p>Example: * <pre><blockquote> * TopLink: employee.anyOf("managedEmployees").get("firstName").equal("Bob") * Java: no direct equivalent * SQL: SELECT DISTINCT ... WHERE (t2.MGR_ID (+) = t1.ID) AND (t2.F_NAME = 'Bob') * </pre></blockquote> */ public Expression anyOfAllowingNone(String attributeName) { QueryKeyExpression queryKey = newDerivedExpressionNamed(attributeName); queryKey.doUseOuterJoin(); queryKey.doQueryToManyRelationship(); return queryKey; }
/** * ADVANCED: * Return an expression representing traversal of a 1:many or many:many relationship. * This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria. * <p>Example: * <pre><blockquote> * Expression: employee.anyOf("managedEmployees").get("firstName").equal("Bob") * Java: no direct equivalent * SQL: SELECT DISTINCT ... WHERE (t2.MGR_ID (+) = t1.ID) AND (t2.F_NAME = 'Bob') * </pre></blockquote> * @parameter shouldJoinBeIndependent indicates whether a new expression should be created. */ @Override public Expression anyOfAllowingNone(String attributeName, boolean shouldJoinBeIndependent) { QueryKeyExpression queryKey; if (shouldJoinBeIndependent) { queryKey = newDerivedExpressionNamed(attributeName); } else { queryKey = derivedExpressionNamed(attributeName); } queryKey.doUseOuterJoin(); queryKey.doQueryToManyRelationship(); return queryKey; }
/** * ADVANCED: * Return an expression representing traversal of a 1:many or many:many relationship. * This allows you to query whether any of the "many" side of the relationship satisfies the remaining criteria. * <p>Example: * <pre><blockquote> * Expression: employee.anyOf("managedEmployees").get("firstName").equal("Bob") * Java: no direct equivalent * SQL: SELECT DISTINCT ... WHERE (t2.MGR_ID (+) = t1.ID) AND (t2.F_NAME = 'Bob') * </pre></blockquote> * @parameter shouldJoinBeIndependent indicates whether a new expression should be created. */ @Override public Expression anyOfAllowingNone(String attributeName, boolean shouldJoinBeIndependent) { QueryKeyExpression queryKey; if (shouldJoinBeIndependent) { queryKey = newDerivedExpressionNamed(attributeName); } else { queryKey = derivedExpressionNamed(attributeName); } queryKey.doUseOuterJoin(); queryKey.doQueryToManyRelationship(); return queryKey; }
/** * INTERNAL: * Rebuild myself against the base, with the values of parameters supplied by the context * expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) * into part of some larger expression. You normally would not call this directly, instead calling twist * See the comment there for more details" */ @Override public Expression twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase) { if (oldBase == null || this.baseExpression == oldBase) { Expression twistedBase = this.baseExpression.twistedForBaseAndContext(newBase, context, oldBase); QueryKeyExpression result = (QueryKeyExpression)twistedBase.get(getName()); if (shouldUseOuterJoin) { result.doUseOuterJoin(); } if (shouldQueryToManyRelationship) { result.doQueryToManyRelationship(); } return result; } return this; }
/** * INTERNAL: * Rebuild myself against the base, with the values of parameters supplied by the context * expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) * into part of some larger expression. You normally would not call this directly, instead calling twist * See the comment there for more details" */ @Override public Expression twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase) { if (oldBase == null || this.baseExpression == oldBase) { Expression twistedBase = this.baseExpression.twistedForBaseAndContext(newBase, context, oldBase); QueryKeyExpression result = (QueryKeyExpression)twistedBase.get(getName()); if (shouldUseOuterJoin) { result.doUseOuterJoin(); } if (shouldQueryToManyRelationship) { result.doQueryToManyRelationship(); } return result; } return this; }
/** * INTERNAL: * Rebuild myself against the base, with the values of parameters supplied by the context * expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) * into part of some larger expression. You normally would not call this directly, instead calling twist * See the comment there for more details" */ public Expression twistedForBaseAndContext(Expression newBase, Expression context) { Expression twistedBase = getBaseExpression().twistedForBaseAndContext(newBase, context); QueryKeyExpression result = (QueryKeyExpression)twistedBase.get(getName()); if (shouldUseOuterJoin) { result.doUseOuterJoin(); } if (shouldQueryToManyRelationship) { result.doQueryToManyRelationship(); } return result; }