borinquenkid opened a new pull request, #16820: URL: https://github.com/apache/grails-core/pull/16820
### Summary Resolves two lifecycle defects with deferred criteria (`whereLazy`, `buildLazy`): 1. **Unmaterialized Subqueries**: Deferred criteria passed as subqueries (`inList`, `gtAll`, `notIn`, `ne`, `exists`, `notExists`, `JpaQueryBuilder`) were not materialized before reading their restrictions and projections, causing subquery predicates to be silently dropped. 2. **Thread-Safe Materialization on Copies**: Previously, `applyLazyCriteria()` mutated the `DetachedCriteria` instance in place on first execution, which was prone to race conditions and duplicate criteria/projections when shared across threads. `QueryableCriteria.materializeLazyCriteria()` (implemented on `AbstractDetachedCriteria` / `DetachedCriteria`) clones the criteria and applies `lazyQuery` on the copy, leaving the original instance unmutated. > **Note:** Chained on top of #16818 (`fix/h7-criteria-projection-immutability-8.0.x`). Fixes #16814 -- 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]
