As of HHH-7610, Hibernate should regard empty composite values and {{null} as equivalent.
Currently, when a composite value is compared to {{null}} by either {{ComponentType#isEqual}} implementation, each value in the empty composite it compared to {{null}}.
If the empty composite has a primitive attribute, {{ComponentType#isEqual}} will always return {{false}} (because a primitive attribute cannot be null).
In addition, if the component is mapped with a parent ({{@Parent}}), and the parent is non-null when the empty composite is instantiated by {{ComponentType#instantiate(Object parent, SharedSessionContractImplementor session)}}, then the parent is injected into the empty composite. When {{ComponentType#isEqual}} is used to check if the empty composite with non-null parent is equivalent to {{null}}, {{false}} will be returned because the parent will be compared with {{null}}. |
|