-
-
Notifications
You must be signed in to change notification settings - Fork 956
No support to refer to root criteria alias from subquery #14623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The above is already possible with where queries. See commit above. |
@graemerocher - yes, creating alias that way for where queries is already explained on reference documentation... However that does not work when i want to use detached criteria/(or where query) as subquery in Criteria query (withCriteria/createCriteria). See my example for Author criteria, creating alias as you mentioned wont work there. |
I think the issue here is, the alias for criteria and alias for subquery conflicts as both are using the "this" as alias. So probably one solution is to do
|
is there a way to use alias as u explained, with detached criteria as subquery for a criteria (see my original example at the top) Or it must be done as my above post ? Looks like its possible only with where queries, but not when u use where query as subquery to a criteria |
…plugin to v2.0.2 (#884) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
What i am trying to achieve is almost similar to what discussed here http://grails.1312388.n4.nabble.com/Subqueries-in-criteria-tp1678501p3078371.html --
Given the domain classes
I would like to find all authors who has published book in 2016 (using criteria and exists)
So i would expect some thing like this to work
However this doesnt give the expected result, and generated sql query looks wrong.
What is expected:
A way to refer to root criteria alias, when doing subqueries
The text was updated successfully, but these errors were encountered: