Hibernate 7: do repeated blocks of one association share a join, or does each block get its own?
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
- 25/100
Línea de trabajo
Start with AssociationBlockJoinDecisionSpec, then compare the two test groups enabled by ALIAS_BLOCK_DECISION=shared and per-block. Read the related behavior and tests in #16773 and #16863, especially AssociationSortSpec, to understand the competing join and ordering rules. The work is complete when one rule is chosen, its tests define the contract, and the other test group is removed.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The question
When a criteria query names the same association in more than one block, does each block get its own join, or do they all share one?
Pet.withCriteria {
owner { scores { eq('round', 'first') } }
owner { scores { eq('round', 'second') } }
}
An owner has one score in each round. If the two scores blocks share a join, one score has to be in both rounds and no pet matches. If each block is its own scope, the pet of an owner with a score in each round matches.
What each version does today
| Query | Hibernate 5 | Hibernate 7 on 8.0.x |
Hibernate 7 with #16773 |
|---|---|---|---|
| the query above | no rows | the pet of the owner with both rounds | no rows |
one owner block that contains both scores blocks |
no rows | no rows | no rows |
two top-level likes blocks, x then y |
no rows | no rows | no rows |
Hibernate 5 and #16773 share the join. 8.0.x shares it for repeated blocks at the top level and inside one block, but not for a nested block under a repeated parent block, which looks like a side effect of how blocks are translated and not a rule. #16863 has tests that assert that result, six test cases in AssociationSortSpec.
A second question comes with it. When an association has several aliases or blocks, which join does an order by the path (order('scores.score')) sort by: the join of the first alias, as #16773 documents, or the join of the block the order is in, as #16863 asserts?
Why this is open
Hibernate 5 is not a reliable reference for this. Its rows for nested blocks depend on the order of the steps and on whether the criteria runs at the top or in a subquery, so it can only be one input. Both answers can be built on JPA. Each one changes the rows of an existing kind of query.
What is in place
AssociationBlockJoinDecisionSpec holds both answers as tests, each switched off until this is decided. The environment variable ALIAS_BLOCK_DECISION set to shared or per-block turns one group on, so either can be tried locally. Once decided, the chosen group becomes the contract and the other is deleted.
Related: #16773, #16863, #16866, #16851.
- Lenguaje dominante
- Groovy
- Estrellas
- 2.9k
- Forks
- 980
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 130
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/grails-core
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
apache/grails-core#16874 ·
Los mantenedores suelen responder en 1 día
-
Hibernate 7: a sort by an alias that the query does not define throws a NullPointerExceptionAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
apache/grails-core#16858 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/grails-core#16289 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Update documentation for Java 25Posiblemente ocupada @ruthst00 la tomó hace 32 días. Abiertorelates-to: documentation weekly-action-item
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/grails-core#15725 ·
Los mantenedores suelen responder en 1 día
-
type: improvement
Dificultad 3/5 1-2 días Aptitud para principiantes 66/100
apache/grails-core#16887 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/grails-core
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
Los mantenedores suelen responder en 4 días
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
NVIDIA/auto-ontology#463 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RustCrypto/utils#1597 ·
Los mantenedores suelen responder en 1 día
-
/shutdown/ready can fail to return an HTTP response when readiness takes longer than the server write timeoutPosiblemente ocupada @floriankoch la tomó hoy. Abiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
envoyproxy/gateway#10562 ·
Los mantenedores suelen responder en 1 día