Below is my HQL Query.
delete from Table t
where
(t.column1=:value1 and t.column2=:value2)
or (t.column3=:value3 and t.column4=:value4)
When I run this query it generates the following SQL which is wrong.
delete from Table t
where
t.column1=?
and t.column2=?
or t.column3=?
and t.column4=?
The parentheses are removed in the generated SQL which is giving me the wrong result.
Please help.
thats not a structured solution, but just to make things work. Can u plz try this
i dnt have hibernate installed at the momenet, but i believe once this issue came to me and i resolved it like this (I guess so)
NHibernate HQL logic problem
https://hibernate.onjira.com/browse/HHH-550
after going through these links, i have figured out (this may be wrong) that Hibernate is translating these queries perfectly.
“AND” has a higher precedence, so results of query should not be effected at all…there might be some other reason