Hello,
I have a simple HQL query like : " From Table WHERE Prop = :x "
It works in most cases but I have a problem when x is "null".
When x is null I'm expecting that Hibernate translates this HQL query into a SQL query like " select * from table where prop is null "
But the "getNamedQuery" method needs a Hashtable to define the parameters. And I cannot put a null value in a Hashtable.
If I don't define the x parameter at all in the getNamedQuery, it throws an error.
I did a quick fix. I've created two HQL queries. One with " Prop = :x " and the other with the literal : " Prop is null ".
If x is not null I call the first HQL query. Else the second one.
But I really don't like that so if anybody knows another way to fix it, it'd be great!
Thanks
|