Since you mentioned H5.6, just wanted to add that previously, in Hibernate 5 the "ansinull" setting was not considered, so the semantics of the = operator were dependent on the database settings. With Hibernate 6, the setting is read on startup to determine how to render predicates, so that the semantics of HQL are adhered. The thing you want is the so called "distinct from" predicate, which treats null = null as true. |