borinquenkid opened a new issue, #16804:
URL: https://github.com/apache/grails-core/issues/16804

   Split from monolithic audit #16674 (findings F1, F2, F13, F14, F15a, F15b, 
F16, F22, F26, F27).
   
   ### Problem Description
   An audit of the Hibernate 7 criteria read translation against the reference 
manual and Hibernate 5 identified several discrepancies in query generation, 
function evaluation, and subquery alias handling:
   
   1. **Where-Query Functions (F13)**: Functions like `upper()`, `lower()`, 
`trim()`, `length()`, and `year()` threw `UnsupportedOperationException`, 
despite being documented and previously supported in Hibernate 5.
   2. **Subquery Comparison Expressions (F14)**: Comparing a property with a 
subquery (e.g., `gt "age", new DetachedCriteria(Person).build { projections { 
avg "age" } }`) incorrectly bound the criteria instance as a query parameter 
rather than translating to a SQL subquery expression.
   3. **Subquery Alias Resolution (F15b, F22, F27)**:
      - Root criteria aliases were unresolvable from subqueries (see also 
#14623).
      - Comparisons through nested alias paths (e.g. `t.club.id`) were 
evaluated at runtime rather than translated into SQL joins.
      - `AbstractDetachedCriteria.clone()` omitted the root alias, causing 
derived criteria (`whereLazy`, `sort`, `build`) to lose the alias and fail with 
`Cannot resolve property`.
   4. **Unresolved Property Paths (F15a)**: An unresolved property path in a 
property comparison was silently dropped, causing every row to match.
   5. **Nulls in `inList` (F16)**: `in`/`inList` containing a `null` member 
failed the entire query rather than handling null according to SQL / dialect 
semantics.
   6. **Thread-Safe Deferred Criteria & Projection List Mutation (F1, F2, 
F26)**:
      - Translating a subquery mutated the criteria projection list in place, 
altering subsequent executions.
      - Deferred criteria (`whereLazy`/`buildLazy`) applied closures in place 
on first use, risking duplicate criteria/projections under concurrent access. 
Materialization must copy rather than mutate in place.
   
   ### Expected Behavior
   Criteria queries with functions, subqueries, aliases, and deferred execution 
should translate cleanly without dropping restrictions or mutating criteria 
state.


-- 
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]

Reply via email to