Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search


Design Specification: JPA 2.1 Arithmetic expressions with Sub-Queries

ER 350597

Document History

Date Author Version Description & Notes
04 November 2011 Gordon Yorke Initial Document Created
28 May 2012 James Sutherland Feature complete through this

Project overview

The next iteration of the Java Persistence API specification has added requirements for allowing SubQueries within arithmetic expressions. For example "select e from Employee e where e.salary > (select avg(emp.salary) from Employee emp where emp.managedEmployee is not empty)" . In the past this was not allowed by the BNF.


Both the antlr and the java based parsers should be updated to allow and support SubQueries as part of an arithmetic expression. Support within the internal Expression framework must be verified as well. Currently the specification only requires this support within the WHERE and HAVING clauses.

Design Constraints

Design / Functionality


Multiple tests using sub selects within WHERE and Having clauses must be created. The tests should also mix having the Sub Query on both sides of the arithmetic operator and with numerous operators.



Config files


Open Issues

This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.

Issue # Owner Description / Notes


This section lists decisions made. These are intended to document the resolution of open issues or constraints added to the project that are important.

Issue # Description / Notes Decision

Future Considerations

During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.

Back to the top