/** * PUBLIC: * Include the number of rows returned by the query in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: * Java: * reportQuery.addCount(); * SQL: * SELECT COUNT (*) FROM ... * @see #addCount(java.lang.String) */ public void addCount() { addCount("COUNT", getExpressionBuilder()); }
/** * PUBLIC: * Include the number of rows returned by the query in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: * Java: * reportQuery.addCount(); * SQL: * SELECT COUNT (*) FROM ... * @see #addCount(java.lang.String) */ public void addCount() { addCount("COUNT", getExpressionBuilder()); }
/** * PUBLIC: * Include the number of rows returned by the query in the result. * Aggregation functions can be used with a group by, or on the entire result set. * EXAMPLE: * Java: * reportQuery.addCount(); * SQL: * SELECT COUNT (*) FROM ... * @see #addCount(java.lang.String) */ public void addCount() { addCount("COUNT", getExpressionBuilder()); }
/** * 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: * <blockquote><pre> * TopLink: reportQuery.addCount("id"); * SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ... * </pre></blockquote> * @param attributeName the number of rows where attributeName is not null will be returned. * @see #addCount(java.lang.String, org.eclipse.persistence.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. * <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, org.eclipse.persistence.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. * <p>Example: * <blockquote><pre> * TopLink: reportQuery.addCount("id"); * SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ... * </pre></blockquote> * @param attributeName the number of rows where attributeName is not null will be returned. * @see #addCount(java.lang.String, org.eclipse.persistence.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, org.eclipse.persistence.expressions.Expression) */ public void addCount(String attributeName, Class resultType) { addCount(attributeName, getExpressionBuilder().get(attributeName), resultType); }
/** * 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: * <blockquote><pre> * TopLink: reportQuery.addCount("id", Long.class); * SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ... * </pre></blockquote> * @param attributeName the number of rows where attributeName is not null will be returned. * @see #addCount(java.lang.String, org.eclipse.persistence.expressions.Expression) */ public void addCount(String attributeName, Class resultType) { addCount(attributeName, getExpressionBuilder().get(attributeName), resultType); }
/** * 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: * <blockquote><pre> * TopLink: reportQuery.addCount("id", Long.class); * SQL: SELECT COUNT (t0.EMP_ID) FROM EMPLOYEE t0, ... * </pre></blockquote> * @param attributeName the number of rows where attributeName is not null will be returned. * @see #addCount(java.lang.String, org.eclipse.persistence.expressions.Expression) */ public void addCount(String attributeName, Class resultType) { addCount(attributeName, getExpressionBuilder().get(attributeName), resultType); }
/** * PUBLIC: A logical expression for the size of collection <code>attributeName</code>. * <p>Example: * <pre><blockquote> * TopLink: employee.size("phoneNumbers") * Java: employee.getPhoneNumbers().size() * SQL: SELECT ... FROM EMP t0 WHERE ... * (SELECT COUNT(*) FROM PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID)) * </blockquote></pre> * This is a case where a fast operation in java does not translate to an * equally fast operation in SQL, requiring a correlated subselect. */ public Expression size(String attributeName) { // Create an anoymous subquery that will get its reference class // set during SubSelectExpression.normalize. ReportQuery subQuery = new ReportQuery(); subQuery.addCount(); subQuery.setSelectionCriteria(subQuery.getExpressionBuilder().equal(this.anyOf(attributeName))); return subQuery(subQuery); }
/** * PUBLIC: A logical expression for the size of collection expression. * <p>Example: * <pre><blockquote> * TopLink: employee.size(Class returnType) * Java: employee.getPhoneNumbers().size() * SQL: SELECT ... FROM EMP t0 WHERE ... * (SELECT COUNT(*) FROM PHONE t1 WHERE (t0.EMP_ID = t1.EMP_ID)) * </blockquote></pre> * This is a case where a fast operation in java does not translate to an * equally fast operation in SQL, requiring a correlated subselect. */ public Expression size(Class returnType) { // Create an anonymous subquery that will get its reference class // set during SubSelectExpression.normalize. ReportQuery subQuery = new ReportQuery(); subQuery.addCount("COUNT", subQuery.getExpressionBuilder(), returnType); subQuery.setSelectionCriteria(subQuery.getExpressionBuilder().equal(this)); if (((BaseExpression)this).getBaseExpression() == null){ return this.subQuery(subQuery); } return ((BaseExpression)this).getBaseExpression().subQuery(subQuery); }
subQuery.setExpressionBuilder(baseExpression.getBuilder()); subQuery.setReferenceClass(sourceClass); subQuery.addCount(attribute, subQuery.getExpressionBuilder().anyOf(attribute), returnType); return; subQuery.addCount("COUNT", subQuery.getExpressionBuilder(), returnType); if (attribute != null){ subQuery.setSelectionCriteria(subQuery.getExpressionBuilder().equal(criteriaBase.anyOf(attribute)));
subQuery.setExpressionBuilder(baseExpression.getBuilder()); subQuery.setReferenceClass(sourceClass); subQuery.addCount(attribute, subQuery.getExpressionBuilder().anyOf(attribute), returnType); return; subQuery.addCount("COUNT", subQuery.getExpressionBuilder(), returnType); if (attribute != null){ subQuery.setSelectionCriteria(subQuery.getExpressionBuilder().equal(criteriaBase.anyOf(attribute)));