Am I correct in assuming this scenario is a bug with HQL (using SQL Server dialect, Hibernate 4.3.4):
Assume I have two entites, Foo and Bar. Foo contains a ManyToOne mapping to the Bar entity (foo.bar) and Bar has a composite PK (col1, col2).
My HQL looks like this:
Code:
Bar bar = <read bar entity with PK ("abc", "123")>;
return session.createQuery("SELECT f FROM Foo WHERE f.bar != :bar").setParameter("bar", bar).list();
However, the generated SQL looks like this:
Code:
select <columns> from foo WHERE foo.col1 <> 'abc' AND foo.col2 <> '123'
It seems like this HQL should actually be converted to something like this:
Code:
select <columns> from foo WHERE (foo.col1 <> 'abc' OR foo.col2 <> '123')