Missing order by clause when there is a redundant right parenthesis in an HQL statement

Description

When there is a redundant right parenthesis in a HQL statement, the generated SQL will lost the order by clause.

Example HQL statement:
select book from Book book where book.title like :title) order by book.title

Generated SQL statement:
select
book0_.id as id1_1_,
book0_.publicationDate as publicat2_1_,
book0_.subtitle as subtitle3_1_,
book0_.title as title4_1_
from Book book0_
where book0_.title like ?

Environment

None

Assignee

Unassigned

Reporter

Daniel Qian

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure