Hibernate 7: an entity that is embedded and declares a hasMany is also bound standalone, with the holder's foreign key
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- groovy
- Lĩnh vực
- databases
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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).
- Ngôn ngữ chính
- Groovy
- Star
- 2.9k
- Fork
- 976
- Merge trung bình
- 21 giờ 14 phút
- Pull request đã merge (30 ngày)
- 174
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của apache/grails-core
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
apache/grails-core#16635 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
apache/grails-core#16289 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
apache/grails-core#15764 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Update documentation for Java 25Có thể đã có người làm @ruthst00 đã nhận 8 ngày trước. Đang mởrelates-to: documentation weekly-action-item
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
apache/grails-core#15725 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
apache/grails-core#16633 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của apache/grails-core
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Self-hosted image skips migrations: Prisma 7.3 CLI rejects the partialIndexes preview featureĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
elie222/inbox-zero#4160 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai_p1 comp-message-queues
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ClickHouse/ClickHouse#125890 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Missing output encoding in `delete_json_doc`: `id` is echoed raw in the confirmation messageĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
bug performance scalability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Davidjustice28/basildb#35 ·