You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Hibernate 7: split HqlQueryContext into HqlText, QueryParameters and QuerySettings #16616
HqlQueryContext (GORM for Hibernate 7) is a record that also holds the HQL scanner, the query rewriting and the parameter handling. Split it into small classes once the Groovy conversion of the module has landed.
Why
PR #16597 fixes HQL queries with a subquery being rewritten into invalid HQL. The defect came from a text scanner living next to parameter handling: indexOf("select ") and indexOf(" from ") were repeated in four methods, each with its own idea of where the query itself starts. #16597 puts the search in two helpers, but they are still private static methods of the same record, and every method still lowercases and rescans the string.
Proposal
HqlText (or HqlStatement): the HQL string and everything that reads it: the top-level select/from search (outside parentheses, string literals, quoted identifiers and comments), normalizeNonAliasedSelect, getRootAlias, countHqlProjections, getSingleProjectionClause and the result type. The positions are found once.
QueryParameters: the named and positional parameters, the expansion of a GString, and convertValue.
QuerySettings: the settings map and the hints, with the AvailableHints filter inside the class.
HqlQueryContext: a thin record of the three, the target class and the isUpdate/isNative flags.
No change of behavior. HqlQueryContextSpec and HibernateGormStaticApiSpec stay as they are and are the safety net; add small specs for HqlText and QueryParameters, including a leading with clause, names that contain select, and escaped quotes.
Order change: the review of #16719 asks for HqlText to start there, on 8.0.x, with the root-query unwrapping and the union-branch case from #16712 as its first spec rows. #16572 then carries the split up in its merge-up. QueryParameters and QuerySettings stay as separate follow-ups.
Step 0, before HqlText: a shared SqlText scanner on 8.0.x (branch feat/sql-text-8.0.x, with the fix for #16717), so that HqlQueryContext, SqlProjection and SqlRestriction stop carrying their own quote and comment rules. HqlText then builds on it.
Steps 0 and 1 are in #16735: SqlText (one scanner, one read per text) and HqlText (one reading per HQL query, used by HqlQueryContext.prepare), plus HqlKeyword. Left for a follow-up: QueryParameters and QuerySettings.
Activity
borinquenkid commentedon Oct 22, 2026
Order change: the review of #16719 asks for
HqlTextto start there, on 8.0.x, with the root-query unwrapping and the union-branch case from #16712 as its first spec rows. #16572 then carries the split up in its merge-up.QueryParametersandQuerySettingsstay as separate follow-ups.borinquenkid commentedon Oct 22, 2026
Step 0, before
HqlText: a sharedSqlTextscanner on 8.0.x (branchfeat/sql-text-8.0.x, with the fix for #16717), so thatHqlQueryContext,SqlProjectionandSqlRestrictionstop carrying their own quote and comment rules.HqlTextthen builds on it.borinquenkid commentedon Oct 22, 2026
Steps 0 and 1 are in #16735:
SqlText(one scanner, one read per text) andHqlText(one reading per HQL query, used byHqlQueryContext.prepare), plusHqlKeyword. Left for a follow-up:QueryParametersandQuerySettings.Hibernate 7: one scanner for the query package, and keep a spaced sql…