jsr338-experts@jpa-spec.java.net

[jsr338-experts] subqueries

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Thu, 07 Apr 2011 16:02:52 -0700

Compared to SQL, JPQL is quite restrictive in terms of the use
of subqueries.

I'd like us to consider whether we should loosen the rules somewhat
to allow subqueries to be used in expressions (i.e., arithmetic
expressions, string expressions, etc.) within predicates.

This would entail changing the BNF such that "(subquery)" was permitted
within arithmetic_primary, string_primary, datetime_primary,
and boolean_primary. (As a result, string_expression and string_primary
would be collapsed, datetime_expression and datetime_primary, ...,
and arithmetic_expression and simple_arithmetic_expression.)

I am proposing that if we do this that we continue to restrict the
use of subqueries to the WHERE and HAVING clauses in this release.
I.e., I am not proposing to open up the bigger issue of whether
to extend subquery use into other clauses now.

Opinions?

thanks,

-Linda