Hibernate 7: an entity that is embedded and declares a hasMany is also bound standalone, with the holder's foreign key
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 18/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- groovy
- Área
- databases
Línea de trabajo
The bug sits in GormMappingConfigurationStrategy.getOrCreateEmbeddedEntity, where an embedded @Entity type returns the same PersistentEntity, and in TableForManyCalculator, which names the join table from the property owner. Start by reading how mappings.addTable is reached for both bindings and reproduce with the EmbeddedHolder/EmbeddedWithMany/EmbeddedMember classes from the issue. Done means the standalone collection gets its own table and key, or the component-only binding is the sole one that is created.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What happens
An entity that is embedded in another and also declares a hasMany is bound twice: once as a component of its holder and once as an entity of its own.
@Entity class EmbeddedHolder { EmbeddedWithMany embed; static embedded = ['embed'] }
@Entity class EmbeddedWithMany { static hasMany = [members: EmbeddedMember] }
@Entity class EmbeddedMember { String name }
GormMappingConfigurationStrategy.getOrCreateEmbeddedEntity returns the same PersistentEntity when the embedded type is itself an @Entity, so the standalone binding is always there, even if EmbeddedWithMany is never used on its own. Both bindings resolve the same join table name (TableForManyCalculator names it from the property's owner), and mappings.addTable hands back the same Table for both. The standalone collection's key therefore ends up with the holder's foreign key.
Why it matters
The session factory now builds (#16617 fixes the Collection key not bound failure), but the two bindings still share one join table and one key. Anything that relies on the standalone EmbeddedWithMany collection being independent of the holder's would be wrong.
Expected
An embedded entity's hasMany should be bound for the component only, or the two bindings should not share a table and key.
Found in
Review of #16617 (Hibernate 7, 8.0.x).
- Lenguaje dominante
- Groovy
- Estrellas
- 2.9k
- Forks
- 978
- Merge medio
- 1 d 2 h
- PR fusionados (30 d)
- 183
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 74/100
apache/grails-core#16635 ·
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
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/grails-core#15764 ·
Los mantenedores suelen responder en 1 día
-
Update documentation for Java 25Posiblemente ocupada @ruthst00 la tomó hace 10 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
-
Dificultad 3/5 1-2 días Aptitud para principiantes 40/100
apache/grails-core#16660 ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/grails-core
Issues similares
-
[1.x Bug] run-operation --sql reports success but rolls back writes on transaction-capable adaptersAbiertotriage
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
dbt-labs/dbt#16784 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add tests for player queries in backend/src/db/queries.tsPosiblemente ocupada @Ayinkx la tomó hoy. Abiertobackend good first issue Stellar Wave
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
OlaGreat/starbound-realms#18 · 1 comentario ·
-
Dificultad 2/5 Menos de una hora Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
bug Hacktoberfest help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Adnan9-63/life-tracker#32 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
langchain-ai/langchain-azure#1183 ·
Los mantenedores suelen responder en 1 día