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:
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 ?