Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Hibernate 7: split HqlQueryContext into HqlText, QueryParameters and QuerySettings

オープン
#16,616 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
groovy
領域
backend

調査の方向性

Start with HqlQueryContext and its HqlQueryContextSpec; the issue proposes separating HQL scanning, parameters, and settings into HqlText, QueryParameters, and QuerySettings. Read the dependency order in the issue: #16597 and the Groovy conversion in #16572 must land first, then implement this as a separate refactor on 9.0.x. Keep existing specs intact and add focused specs for leading with, names containing select, and escaped quotes; done means behavior stays unchanged and those specs pass.

索引モデルが issue の本文から書いたものです。

説明

type: improvement

Summary

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

  1. #16597 lands on 8.0.x.
  2. #16572 converts the module to Groovy.
  3. This refactor, on 9.0.x, as its own pull request, so that it is not read as part of a mechanical language conversion.
主要言語
Groovy
スター
2.9k
フォーク
976
平均マージ
21時間 14分
マージ済み PR(30日)
174

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/grails-core のほかの issue

apache/grails-core の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。