atchris wrote:
Hi all, I am trying to create a query using HQL .
I am not sure if it is just a beginner's problem but it really blocks my way.
Here is the SQL that I pass into the function getSession().createQuery() (for illustration purpose):
select key, val from mytable where ((1=1 and 2=2) or (3=3 and 4=4))
and here is the GENERATED SQL (from show_sql):
select mytable0_.key as col_0_0_, mytable0_.val as col_1_0_ from mytable mytable0_ where 1=1 and 2=2 or 3=3 and 4=4
(The brackets are all gone which gives totally different result from what I expect, I want condition 1 AND 2 together OR 3 AND 4 together)
I am using Hibernate 3.
Could anyone help?
Thank you very much.
http://www.databasedev.co.uk/sql-multip ... tions.html
I just found here that the operations order (Beginners level~), so the removing of brackets is CORRECT!.