Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Hibernate 7: split HqlQueryContext into HqlText, QueryParameters and QuerySettings

Abierto
#16,616 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
groovy
Área
backend

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
Groovy
Estrellas
2.9k
Forks
976
Merge medio
21 h 14 min
PR fusionados (30 d)
174

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/grails-core

Todos los issues de apache/grails-core

Issues similares

Más issues de Backend & API Design

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.