We're updating the issue view to help you get more done. 

Bad query generated with or / and conditions in parenthesis

Description

I used HQL to query 2 tables with and / or conditions which need parenthesis : (a = 'user' OR a is null AND b = 'xxx')

query is like this :
select pal from Priority as pal, Preparation as pre where … and
(pre.user = :user or pre.user is null and pre.exit = :typeExit) …
order by …

THEN, the request done in DB is :
select pal from Priority as pal, Preparation as pre where … and
(pre.user=$3 or (pre.user is null) and pre.exit=$4) …
order by …

Here, parenthesis are not at the same place, which change the query, and then the result.

I did few other tests to find a turnover without success.
Example with additional parenthesis :
(pre.user = :user or (pre.user is null and pre.exit = :typeExit))

Environment

Windows/Linux
hibernate-core 4.2.5-final
postgres 9.x

Status

Assignee

Unassigned

Reporter

BertrandL

Labels

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Affects versions

1.0.0.Alpha5

Priority

Major