Add one-to-many module: @OneToMany in Hibernate 7.4.16.Final (unidirectional join table vs @JoinColumn vs mappedBy, Set vs List removal cost, sync helper, fetch defaults, N+1, MultipleBagFetchException fixes, id-hashCode trap)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b4H5ph3J7k2MJnRuVH
This commit is contained in:
asmhatre
2026-11-16 10:49:49 +05:30
co-authored by Claude Sonnet 5.5
parent bdae169002
commit eab5461d86
24 changed files with 1560 additions and 0 deletions
@@ -0,0 +1,6 @@
# JPA fetch defaults: @OneToMany is LAZY, @ManyToOne is EAGER
# Hibernate ORM 7.4.16.Final, H2, JDK 25
-- find(EagerEmployee) with @ManyToOne at its default
sql> select ee1_0.id,d1_0.id,d1_0.name,ee1_0.name from EagerEmployee ee1_0 left join EagerDepartment d1_0 on d1_0.id=ee1_0.dept_id where ee1_0.id=?
-- find(EagerDepartment): the @OneToMany collection is not loaded
sql> select ed1_0.id,ed1_0.name from EagerDepartment ed1_0 where ed1_0.id=?