/** * PUBLIC: * Specify the relationship attribute to be join fetched in this query. * The query will join the object(s) being read with the attribute, * this allows all of the data required for the object(s) to be read in a single query instead of (n) queries. * This should be used when the application knows that it requires the part for all of the objects being read. * * <p>Note: This cannot be used for objects where it is possible not to have a part, * as these objects will be omitted from the result set, * unless an outer join is used through passing and expression using "getAllowingNull". * To join fetch collection relationships use the addJoinedAttribute(Expression) using "anyOf" to "anyOfAllowingNone". * * <p>Example: query.addJoinedAttribute("address") * * @see #addJoinedAttribute(Expression) * @see ReadAllQuery#addBatchReadAttribute(Expression) */ public void addJoinedAttribute(String attributeName) { addJoinedAttribute(getExpressionBuilder().get(attributeName)); }
/** * INTERNAL * Check for any JOIN FETCH nodes of the current variable and add them as * joined attributes. This method is called in case of a non ReportQuery * instance. */ private void addFetchJoins(ObjectLevelReadQuery theQuery, GenerationContext context) { String name = getCanonicalVariableName(); List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); if (fetchJoinNodes != null) { for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { Node node = (Node)i.next(); theQuery.addJoinedAttribute(node.generateExpression(context)); } } }
/** * INTERNAL * Check for any JOIN FETCH nodes of the current variable and add them as * joined attributes. This method is called in case of a non ReportQuery * instance. */ private void addFetchJoins(ObjectLevelReadQuery theQuery, GenerationContext context) { String name = getCanonicalVariableName(); List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); if (fetchJoinNodes != null) { for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { Node node = (Node)i.next(); theQuery.addJoinedAttribute(node.generateExpression(context)); } } }
/** * PUBLIC: * Specify the one-to-one mapped attribute to be join fetched in this query. * The query will join the object(s) being read with the one-to-one attribute, * this allows all of the data required for the object(s) to be read in a single query instead of (n) queries. * This should be used when the application knows that it requires the part for all of the objects being read. * * <p>Note: This cannot be used for objects where it is possible not to have a part, * as these objects will be omitted from the result set, * unless an outer join is used through passing and expression using "getAllowingNull". * To join fetch collection relationships use the addJoinedAttribute(Expression) using "anyOf" ot "anyOfAllowingNone". * * <p>Example: query.addJoinedAttribute("address") * * @see #addJoinedAttribute(Expression) * @see ReadAllQuery#addBatchReadAttribute(Expression) */ public void addJoinedAttribute(String attributeName) { addJoinedAttribute(getExpressionBuilder().get(attributeName)); }
/** * INTERNAL * Check for any JOIN FETCH nodes of the current variable and add them as * joined attributes. This method is called in case of a non ReportQuery * instance. */ private void addFetchJoins(ObjectLevelReadQuery theQuery, GenerationContext context) { String name = getCanonicalVariableName(); List fetchJoinNodes = context.getParseTreeContext().getFetchJoins(name); if (fetchJoinNodes != null) { for (Iterator i = fetchJoinNodes.iterator(); i.hasNext(); ) { Node node = (Node)i.next(); theQuery.addJoinedAttribute(node.generateExpression(context)); } } }
/** * PUBLIC: * Specify the relationship attribute to be join fetched in this query. * The query will join the object(s) being read with the attribute, * this allows all of the data required for the object(s) to be read in a single query instead of (n) queries. * This should be used when the application knows that it requires the part for all of the objects being read. * * <p>Note: This cannot be used for objects where it is possible not to have a part, * as these objects will be omitted from the result set, * unless an outer join is used through passing and expression using "getAllowingNull". * To join fetch collection relationships use the addJoinedAttribute(Expression) using "anyOf" to "anyOfAllowingNone". * * <p>Example: query.addJoinedAttribute("address") * * @see #addJoinedAttribute(Expression) * @see ReadAllQuery#addBatchReadAttribute(Expression) */ public void addJoinedAttribute(String attributeName) { addJoinedAttribute(getExpressionBuilder().get(attributeName)); }
queryExpression = queryContext.buildExpression(joinFetch); query.addJoinedAttribute(queryExpression);
queryExpression = queryContext.buildExpression(joinFetch); query.addJoinedAttribute(queryExpression);
olrq.addJoinedAttribute(expression); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)}));
olrq.addJoinedAttribute(expression); } else { throw new IllegalArgumentException(ExceptionLocalization.buildMessage("ejb30-wrong-type-for-query-hint",new Object[]{getQueryId(query), name, getPrintValue(valueToApply)}));
List<org.eclipse.persistence.expressions.Expression> list = ((FromImpl) this.roots.iterator().next()).findJoinFetches(); for (org.eclipse.persistence.expressions.Expression fetch : list) { query.addJoinedAttribute(fetch); List<org.eclipse.persistence.expressions.Expression> list = ((FromImpl) this.roots.iterator().next()).findJoinFetches(); for (org.eclipse.persistence.expressions.Expression fetch : list) { query.addJoinedAttribute(fetch); query.addJoinedAttribute(fetch);