As stated in the 6.3 migration guide, the way Hibernate compares null literals has been changed to the SQL default. Previously a SELECT p FROM Parent p WHERE p.child = :child
would find all parents without children if null was passed as parameter child, whereas now no results are returned.
Our application has over 2000 queries. We are worried, that this change might lead to a change in behavior of some of our code. If there is code passing null as a parameter, it might be an error, or it might even be intended. We can’t be sure and we can’t really check all queries with their accompanying logic.
Our idea was to write an interceptor or similar that runs at a time before the query is executed, but the parameters have already been set. We would need access to either the HQL query (preferred) or the SQL translation and the parameters. We would like to parse the query, analyze the parameters and log a warning or throw an exception if the case meets our criteria.
Are there ways to accomplish that, what are they, and how can they be implemented?
Thank you very much in advance!