public QueryKeyExpression derivedExpressionNamed(String attributeName) { QueryKeyExpression existing = existingDerivedExpressionNamed(attributeName); if (existing != null) { return existing; } return newDerivedExpressionNamed(attributeName); }
public QueryKeyExpression derivedExpressionNamed(String attributeName) { QueryKeyExpression existing = existingDerivedExpressionNamed(attributeName); if (existing != null) { return existing; } return newDerivedExpressionNamed(attributeName); }
public QueryKeyExpression derivedExpressionNamed(String attributeName) { QueryKeyExpression existing = existingDerivedExpressionNamed(attributeName); if (existing != null) { return existing; } return newDerivedExpressionNamed(attributeName); }
/** * PUBLIC: * 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 anyOf(String attributeName) { QueryKeyExpression queryKey = newDerivedExpressionNamed(attributeName); 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> * 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; }
/** * PUBLIC: * 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 anyOf(String attributeName, boolean shouldJoinBeIndependent) { QueryKeyExpression queryKey; if (shouldJoinBeIndependent) { queryKey = newDerivedExpressionNamed(attributeName); } else { queryKey = derivedExpressionNamed(attributeName); } queryKey.doQueryToManyRelationship(); return queryKey; }
/** * PUBLIC: * 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 anyOf(String attributeName, boolean shouldJoinBeIndependent) { QueryKeyExpression queryKey; if (shouldJoinBeIndependent) { queryKey = newDerivedExpressionNamed(attributeName); } else { queryKey = derivedExpressionNamed(attributeName); } 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; }
public <Y> Join<X, Y> join(SingularAttribute<? super X, Y> attribute, JoinType jt) { if (((SingularAttribute)attribute).getType().getPersistenceType().equals(PersistenceType.BASIC)){ throw new IllegalStateException(ExceptionLocalization.buildMessage("CAN_NOT_JOIN_TO_BASIC")); } Class clazz = attribute.getBindableJavaType(); Join<X, Y> join = null; ObjectExpression exp = ((ObjectExpression)this.currentNode).newDerivedExpressionNamed(attribute.getName()); if (jt.equals(JoinType.LEFT)){ exp.doUseOuterJoin(); }else if(jt.equals(JoinType.RIGHT)){ throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED")); }else{ exp.doNotUseOuterJoin(); } join = new JoinImpl<X, Y>(this, this.metamodel.managedType(clazz), this.metamodel, clazz, exp, attribute, jt); this.joins.add(join); ((FromImpl)join).isJoin = true; return join; }
/** * Fetch join to the specified attribute using the given join type. * * @param assoc * target of the join * @param jt * join type * @return the resulting fetch join */ public <Y> Fetch<X, Y> fetch(SingularAttribute<? super X, Y> assoc, JoinType jt){ if (((SingularAttribute)assoc).getType().getPersistenceType().equals(PersistenceType.BASIC)){ throw new IllegalStateException(ExceptionLocalization.buildMessage("CAN_NOT_JOIN_TO_BASIC")); } Class clazz = assoc.getBindableJavaType(); Fetch<X, Y> join = null; ObjectExpression exp = ((ObjectExpression)this.currentNode).newDerivedExpressionNamed(assoc.getName()); if (jt.equals(JoinType.LEFT)){ exp.doUseOuterJoin(); }else if(jt.equals(JoinType.RIGHT)){ throw new UnsupportedOperationException(ExceptionLocalization.buildMessage("RIGHT_JOIN_NOT_SUPPORTED")); }else{ exp.doNotUseOuterJoin(); } join = new JoinImpl<X, Y>(this, this.metamodel.managedType(clazz), this.metamodel, clazz, exp, assoc, jt); this.fetches.add(join); ((FromImpl)join).isFetch = true; return join; } /**