borinquenkid opened a new issue, #16813:
URL: https://github.com/apache/grails-core/issues/16813
Split from audit #16804 (findings F15b, F22, F27).
### Problem Description
Correlating subqueries and aliases in criteria queries fails in three
related scenarios:
1. **Root Alias Registration (F15b)**: `JpaCriteriaQueryCreator` never
registers the root alias in `JpaQueryContext`, making `{alias}` or root
variable expressions unresolvable from subqueries (see also #14623).
2. **Nested Alias Paths (F22)**: In `DetachedCriteriaTransformer`, alias
checks use `pe.getObjectExpression().getText()`. For nested paths like
`t.club.id` in `exists(Club.where { id == t.club.id })`,
`getObjectExpression()` returns `t.club` which does not match alias `t`.
3. **Cloned Alias Preservation (F27)**: `AbstractDetachedCriteria.clone()`
omits `criteria.@alias = this.alias`, so derived criteria (`whereLazy`, `sort`,
`build`) lose their root alias.
### Expected Behavior
- `JpaCriteriaQueryCreator` should register root aliases in
`JpaQueryContext`.
- `DetachedCriteriaTransformer` should inspect the root of the expression
chain to resolve aliases across nested property paths.
- `AbstractDetachedCriteria.clone()` should copy `this.alias`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]