jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
191 stars 55 forks source link

allow subqueries to select CompoundSelection #390

Open asafbennatan opened 1 year ago

asafbennatan commented 1 year ago

this is a huge limitation , the only way around is to create an inefficient query.

gavinking commented 11 months ago

Per-spec, subqueries in JPA today can only occur in the where or having clause. Given that limitation, it's not immediately obvious to me why allowing multiple expressions in the select list would be useful.

So, please at least give us an example of the kind of query you would like to write. (A real-world example illustrating the practical usefulness.)

[FTR, Hibernate supports what you're asking for, but Hibernate allows subqueries in other clauses of the query.]

beikov commented 11 months ago

Maybe he is referring to subqueries in the from clause? This seems to be supported as of EclipseLink 2.4 and Hibernate 6.1. Maybe it's time for standardization of this feature?

gavinking commented 11 months ago

Maybe he is referring to subqueries in the from clause?

I mean: sure, maybe? But it's the job of the reporter of an issue to properly describe their issue. It's not our job to speculate what they might have meant from a completely insufficient description of the problem.

Maybe it's time for standardization of this feature?

Well that's why I already opened #401 quite a while ago. So if that's what is being requested we can just close this.