I wanted to get records of Patient
(POJO class) who's contact number is not null. So, I referred this post.
In the answer two ways are specified
SELECT *
FROM table
WHERE YourColumn IS NOT NULL;
SELECT *
FROM table
WHERE NOT (YourColumn <=> NULL);
From above I wrote below hql which runs successfully
from Patient p where p.contactNo is not null
But, for 2nd type of hql
from Patient p where not (p.contactNo <=> null)
throws Exception
org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: >
How can I use mysql null safe equality operator <=>
in HQL?