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

hibernate.query.passDistinctThrough=false does not work when hibernate.use_sql_comments=true

Description

hibernate.query.passDistinctThrough=false hint is ignored if hibernate.use_sql_comments=true.
See attached test case.

The issue is in org.hibernate.loader.Loader.processDistinctKeyword(String, QueryParameters).
It assumes that the query string starts with 'select distinct'. However, if comments are enabled, the query will start with the comment (/..../).

Environment

None

Status

Assignee

Unassigned

Reporter

Alex Litovsky

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.2.18

Priority

Minor