[hibernate-dev] Null vs "empty" embeddable values

Steve Ebersole steve at hibernate.org
Wed Jul 26 09:01:31 EDT 2017

"Requirement" - no.  I think a warning in this case is perfectly fine.

As for JPA, it says nothing about embeddables and nulls.

On Sun, Jul 23, 2017 at 6:49 PM Gail Badner <gbadner at redhat.com> wrote:

> 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
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list