# Not-null = "true" constraint in hbm.xml file, but null passed in database

**URL:** <https://discourse.hibernate.org/t/not-null-true-constraint-in-hbm-xml-file-but-null-passed-in-database/10928>\
**Category:** Hibernate ORM\
**Created:** [January 23, 2025, 2:28pm UTC](https://discourse.hibernate.org/t/not-null-true-constraint-in-hbm-xml-file-but-null-passed-in-database/10928 "2025-01-23T14:28:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akukuc](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@akukuc](https://discourse.hibernate.org/u/akukuc)\
**Post date:** [January 23, 2025, 2:28pm UTC](https://discourse.hibernate.org/t/not-null-true-constraint-in-hbm-xml-file-but-null-passed-in-database/10928/1 "2025-01-23T14:28:18Z")

</div>

Hi,  
We are migrating Java application from 8 to 17. One of the steps was to migrate hibernate.core from version 5.3.3.Final to 5.6.15.Final. After that we got the following error :

Exception javax.persistence.PersistenceException: org.hibernate.PropertyValueException: not-null property references a null or transient value.

In fact, we try to write the record with has a null property and this property is marked as not-null=“true” in hbm.xml file. So it seems like everything is correct. The problem is that this error did not appear in logs before with Java 8 and hibernate 5.3.3 and we can even see that in the database there is a record with this property being null.

Was there any change between those hibernate versions or JRE versions which can affect the behavior of constraint validations set up in hbm.xml files?

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [January 24, 2025, 10:26am UTC](https://discourse.hibernate.org/t/not-null-true-constraint-in-hbm-xml-file-but-null-passed-in-database/10928/2 "2025-01-24T10:26:41Z")

</div>

Quite possibly this was a bug in an Hibernate ORM version that was simply fixed at some point.
