Hibernate 7: do repeated blocks of one association share a join, or does each block get its own?
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Groovy
- Stelle
- 2.9k
- Fork
- 980
- Merge medio
- 2g 4h
- PR unite (30g)
- 130
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di apache/grails-core
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
apache/grails-core#16874 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/grails-core#16858 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
apache/grails-core#16289 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Update documentation for Java 25Forse già presa @ruthst00 l’ha presa 32 giorni fa. Apertarelates-to: documentation weekly-action-item
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
apache/grails-core#15725 ·
I maintainer di solito rispondono entro 1 giorno
-
type: improvement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 66/100
apache/grails-core#16887 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di apache/grails-core
Issue simili
-
`Time.at(t, in: nil)` returns UTC instead of the local time (or the time zone of `t`), unlike CRubyAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
PageParameters.hashCode is inconsistent with equals for named parameters in a different orderAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug implicit-state
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
I maintainer di solito rispondono entro 4 giorni