/** * INTERNAL: * Add an attribute represented by the given attribute name to the list of joins * for this query. * Note: Mapping level joins are represented separately from query level joins */ public void addJoinedMapping(String attributeName) { addJoinedMappingExpression(this.baseExpressionBuilder.get(attributeName)); }
throw QueryException.updateAllQueryAddUpdateDoesNotDefineField(getDescriptor(), getQuery(), attributeName); baseExpression = ((UpdateAllQuery)getQuery()).getExpressionBuilder().get(attributeName); } else if (fieldExpression != null) {
/** * PUBLIC: * Add the minimum value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addMinimum("salary"); */ public void addMinimum(String itemName) { addMinimum(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Add the variance value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addVariance("salary"); */ public void addVariance(String itemName) { addVariance(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Add the attribute from the reference class to be included in the result. * EXAMPLE: reportQuery.addAttribute("firstName"); */ public void addAttribute(String itemName) { addItem(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Add the attribute to the group by expressions. * This will group the result set on that attribute and is normally used in conjunction with aggregation functions. * Example: reportQuery.addGrouping("lastName") */ public void addGrouping(String attributeName) { addGrouping(getExpressionBuilder().get(attributeName)); }
/** * PUBLIC: * Add the average value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addAverage("salary"); */ public void addAverage(String itemName) { addAverage(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Add the maximum value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addMaximum("salary"); */ public void addMaximum(String itemName) { addMaximum(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Add the sum value of the attribute to be included in the result and * return it as the specified resultType. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addSum("salary", Float.class); */ public void addSum(String itemName, Class resultType) { addSum(itemName, getExpressionBuilder().get(itemName), resultType); }
/** * PUBLIC: * Add the average value of the attribute to be included in the result and * return it as the specified resultType. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addAverage("salary", Float.class); */ public void addAverage(String itemName, Class resultType) { addAverage(itemName, getExpressionBuilder().get(itemName), resultType); }
/** * PUBLIC: * Add the standard deviation value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addStandardDeviation("salary"); */ public void addStandardDeviation(String itemName) { addStandardDeviation(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Add the sum value of the attribute to be included in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: reportQuery.addSum("salary"); */ public void addSum(String itemName) { addSum(itemName, getExpressionBuilder().get(itemName)); }
/** * PUBLIC: * Include the number of rows returned by the query in the result, where attributeExpression is not null. * Aggregation functions can be used with a group by, or on the entire result set. * <p>Example: * <pre><blockquote> * TopLink: reportQuery.addCount("id"); * SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ... * </blockquote></pre> * @param attributeName the number of rows where attributeName is not null will be returned. * @see #addCount(java.lang.String, oracle.toplink.essentials.expressions.Expression) */ public void addCount(String attributeName) { addCount(attributeName, getExpressionBuilder().get(attributeName)); }
/** * PUBLIC: * Include the number of rows returned by the query in the result, where attributeExpression is not null. * Aggregation functions can be used with a group by, or on the entire result set. * Set the count to be returned as the specified resultType. * <p>Example: * <pre><blockquote> * TopLink: reportQuery.addCount("id", Long.class); * SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ... * </blockquote></pre> * @param attributeName the number of rows where attributeName is not null will be returned. * @see #addCount(java.lang.String, oracle.toplink.essentials.expressions.Expression) */ public void addCount(String attributeName, Class resultType) { addCount(attributeName, getExpressionBuilder().get(attributeName), resultType); }
/** * PUBLIC: * Specify the one-to-one mapped attribute to be optimized 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. * This can be used only for one-to-one mappings where the target is not the same class as the source, * either directly or through inheritance. Also two joins cannot be done to the same class. * * <p>Note: This cannot be used for objects where it is possible not to have a part, * as these objects will be ommited from the result set, * unless an outer join is used through passing and expression using "getAllowingNull". * * <p>Example: query.addJoinedAttribute("address") * * @see #addJoinedAttribute(Expression) */ public void addJoinedAttribute(String attributeName) { addJoinedAttribute(getExpressionBuilder().get(attributeName)); }
/** * PUBLIC: * Order the query results by the object's attribute or query key name. */ public void addAscendingOrdering(String queryKeyName) { addOrdering(getExpressionBuilder().get(queryKeyName).ascending()); }
/** * PUBLIC: * Order the query results by the object's attribute or query key name. */ public void addDescendingOrdering(String queryKeyName) { addOrdering(getExpressionBuilder().get(queryKeyName).descending()); }
/** * PUBLIC: * Specify the one-to-one mapped attribute to be optimized in this query. * The query will join the object(s) being read with the one-to-one * attribute. The difference between this and a joined attribute is that * it allows data to be retrieved based on a join, but will not populate * the joined attribute. It also 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. This can be used only for one-to-one * mappings where the target is not the same class as the source, either * directly or through inheritance. Also two joins cannot be done to the * same class. * * <p>Note: This cannot be used for objects where it is possible not to have * a part, as these objects will be ommited from the result set, unless an * outer join is used through passing and expression using "getAllowingNull". * * <p>Example: query.addNonFetchJoinedAttribute("address") * * @see #addNonFetchJoinedAttribute(Expression) */ public void addNonFetchJoinedAttribute(String attributeName) { addNonFetchJoinedAttribute(getExpressionBuilder().get(attributeName)); }
/** * PUBLIC: * Provide order support for queryKeyName in ascending order. * Called from the EJBAnnotationsProcessor when an @OrderBy on an * aggregate is found. */ public void addAggregateOrderBy(String aggregateName, String queryKeyName, boolean isDescending) { this.hasOrderBy = true; ReadAllQuery readAllQuery = (ReadAllQuery) getSelectionQuery(); ExpressionBuilder builder = readAllQuery.getExpressionBuilder(); Expression expression = builder.get(aggregateName).get(queryKeyName).toUpperCase(); if (isDescending) { readAllQuery.addOrdering(expression.descending()); } else { readAllQuery.addOrdering(expression.ascending()); } }
query.getFetchGroup().addFetchGroupAttribute(query.getExpressionBuilder().anyOf(attrName)); } else { query.getFetchGroup().addFetchGroupAttribute(query.getExpressionBuilder().get(attrName));