Nullability.checkNullability fails for allowed embedded null object

Description

For the following entity definition the code in org.hibernate.engine.internal.Nullability#checkNullability fails to persist with a PropertyValueException("not-null property references a null or transient value" if the property innerId is null.

This is wrong (since one of the latest 4.1.x releases). It worked with 4.1.7.

The embedded object/property innerId in the entity is optional. The constraint is: "if innerId is not null, the field value must not be null - but it is valid to omit innerId completly".

This bug prevents use of composites in both optional an mandatory way.

Attachments

1

Activity

Show:

Christian Beikov January 21, 2025 at 3:10 PM

This is simply a wrong expectation. If an embeddable has one non-optional or non-nullable attribute, then every attribute using that embeddable type also becomes non-optional i.e. this is transitive.

Steve Ebersole October 28, 2015 at 3:25 AM

As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.

Steve Ebersole October 27, 2015 at 7:16 PM

This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.

For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/

Maël Lavault July 27, 2015 at 1:53 PM

Any progress on this one ?

Maël Lavault February 11, 2015 at 9:57 AM

Any progress on this ?

We tried to update from 4.1.7 to 4.3.8 and had to revert because of this. It makes newer hibernate release unusable for us.

Rejected

Details

Assignee

Reporter

Labels

Components

Affects versions

Priority

Created March 4, 2014 at 2:55 PM
Updated January 21, 2025 at 3:10 PM
Resolved January 21, 2025 at 3:10 PM