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:
co-authored by
Claude Sonnet 5.5
parent
bdae169002
commit
eab5461d86
@@ -0,0 +1,13 @@
|
||||
# Set + id-based hashCode vs UUID-based hashCode: remove() after persist
|
||||
# Hibernate ORM 7.4.16.Final, H2, JDK 25
|
||||
id-based hashCode: Set.remove(child) returned false
|
||||
-- commit
|
||||
sql> insert into IdHashOwner (id) values (default)
|
||||
sql> insert into IdHashChild (name,owner_id,id) values (?,?,default)
|
||||
rows left in IdHashChild: 1 (the child was NOT removed, so orphanRemoval never saw it)
|
||||
UUID-based hashCode: Set.remove(child) returned true
|
||||
-- commit
|
||||
sql> insert into departments (name,id) values (?,default)
|
||||
sql> insert into employees (dept_id,name,uuid,id) values (?,?,?,default)
|
||||
sql> delete from employees where id=?
|
||||
rows left in employees: 0
|
||||
Reference in New Issue
Block a user