Community
Participate
Working Groups
In previous versions of the specification Sub-Queries were not allowed in math expressions in JPQL. In 2.1 the JPQL BNF will be updated to allow subqueries in math expressions. select e from Employee e where e.salary > (select avg(emp.salary) from Employee emp where emp.managedEmployee is not empty)
The BNF has changed to allow the SubQuery in may places in the statement so care must be taken to ensure it is supported throughout the WHERE and HAVING clauses. Although the BNF will allow SubQueries in the SELECT and FROM clauses this is not required by the specification
Created attachment 205826 [details] Adds Expression support for sub-selects in the SELECT from FROM clauses
SVN trunk commit: Bug#350597 sub-selects in SELECT, FROM clause Added support to Expression for sub-selects in the SELECT and FROM clauses. https://bugs.eclipse.org/bugs/show_bug.cgi?id=350597 http://wiki.eclipse.org/EclipseLink/DesignDocs/312146 Code review: Andrei (pending) Changes: - Added getTable(Expression) to Expression. - Moved getContainingDescriptor() up to DataExpression and chnaged code to use it. - Added clonedExpression to ExpressionNormalizer to keep track of identity. - Avoided duplicate normalization in reusable expressions. - Added FromAliasExpression to allow query key like usage on FROM clause sub-selects. - Added FromSubSelectExpression to allow sub-selects in the FROM clause, treated as TableExpressions. - Added SubSelectDatabaseTable to allow sub-selects to be treated as table and printed in the FROM clause. - Added support for print SubSelectExpression in select clause. - Fixed issue of ReportQuery items using rebuild instead of copy. - Fixed mappingCriteria to take the base to ensure the mapping expression is twisted with the correct base. - Changed logging to log the category. - Fixed ReportQuery to copy having clause. - Fixed SchemaManager to reset database event listeners after creating tables. - Added some @Overrides, some cleanup - Added sub-select FROM and SELECT clause tests to expression subs-selects core test suite. - Got Stephen Mcritchie's infamous ParallelCorrelatedSubSelectsTest working finally. - Changed expression tests to unprepare in setup so they can be re-run. - Added JPA JPQL test for sub-select in the HAVING clause and sue with comparison operators.
Support for subs-selects added in Hermes JPQL
Created attachment 214250 [details] fix to FROM sub-selects
SVN trunk commit: Bug#350597 - FROM sub-selects https://bugs.eclipse.org/bugs/show_bug.cgi?id=350597 Code review: Andrei (pending) Changes: - Added core test for FROM sub-selects with aggregation functions. - Excluded union tests from Sybase as it does not support intersect. - Renamed Expression as to treat (deprecated as(Class)). - Added as(String) Expression support for SQL SELECT AS option. - Fixed FromAliasExpression to work with functions. - Fixed FromSubSelectExpression normalize to use AS for functions. - Added TableExpression to allow TABLE operator.
fixed
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink