borinquenkid opened a new pull request, #16800:
URL: https://github.com/apache/grails-core/pull/16800
Fixes #16616.
### Summary
Extracts `QueryParameters` and `QuerySettings` from `HqlQueryContext` in
`grails-data-hibernate7`, completing the decoupling proposed in #16616
following the introduction of `HqlText` in #16735:
1. **`QueryParameters`**:
- Encapsulates named and positional parameters as an immutable value
object with defensive copying.
- Handles `GString` expansion for both named parameters (`:p0`, `:p1`)
and positional parameters (`?1`, `?2` or native `?`).
- Normalizes multiline query strings and converts parameter values for
`CharSequence`, collections, and arrays.
- Provides `expand(...)` returning `Expanded(query, parameters)`.
2. **`QuerySettings`**:
- Encapsulates query execution settings (such as `max`, `offset`,
`timeout`, `flushMode`) with defensive copying.
- Filters JPA hints against `AvailableHints.getDefinedHints()`.
- Provides lookup accessors by `String` and `HibernateQueryArgument` enum
constants.
3. **`HqlQueryContext`**:
- Refactored into a thin record composing the resolved HQL,
`targetClass`, `QueryParameters`, `QuerySettings`, and update/native flags.
- Maintains complete backwards compatibility via the 8-parameter
constructor and delegating accessors (`namedParams()`, `positionalParams()`,
`querySettings()`, `hints()`).
4. **`HqlQueryMethods`**:
- Replaced redundant value conversion logic with delegation to
`QueryParameters.convertValue`.
5. **Tests**:
- Added unit specifications `QueryParametersSpec` and `QuerySettingsSpec`.
--
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]