[hibernate-dev] Null vs "empty" embeddable values
Gail Badner
gbadner at redhat.com
Sun Jul 23 19:45:14 EDT 2017
As of HHH-7610, Hibernate is supposed to treat null and empty embeddable
values as equivalent.
Should we add a requirement that an embeddable class #equals and #hashCode
methods also treats null and "empty" values as equivalent?
That would mean that #hashCode returned for all empty embeddables should be
0, and embeddableValue.equals( null ) should return true for all empty
embeddableValue.
BTW, I've already pushed a fix for HHH-11881 so that nulls are not
persisted for Set elements (they already were not persisted for bags,
idmaps, lists, or maps). I'm holding off on fixing HHH-11883, which would
no longer persist empty embeddable values and would ignore embeddables with
all null columns when initializing collections.
I don't think JPA has any such requirement, and I'm hesitant to enforce
something that may be at odds with JPA.
Comments or opinions?
Thanks,
Gail
More information about the hibernate-dev
mailing list