-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: HQL Bug: not-equals operator against entity w/ composite key
PostPosted: Thu Feb 05, 2015 7:09 pm 
Newbie

Joined: Mon Apr 07, 2014 10:20 am
Posts: 12
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')


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.