Bug was closed as trivial. It is not trivial. It is the result of an incompetent or lazy developer, which is misleading users with a completely useless error message.
When Hibernate is encountering a query with an extraneous parenthesis, instead of reporting a malformed query or the extraneous parenthesis, it reports a 'NullPointerException'. In summary, Hibernate code crashed, with zero clue what happened.
The bug I am reporting is the totally useless error message being shown. Error reporting is not trivial and it takes some competence to report an error correctly. Incompetent error reporting, as in this case, makes users waste time simply because the developer couldn't be bothered.
Please report the error with some clue. Providing hints, such as 'Do you have extraneous parenthesis' would be helpful. Hibernate already prints such messages, so the idea is not novel.
Please use the pattern that you yourself seemed to have considered as correct, and just type in the extra few lines at the right place.
, was not closed because it had status "Trivial". At the time that it was closed, Hibernate 3.x was no longer supported. and no one confirmed that the bug affected Hibernate 4.
Now, Hibernate 4.x is no longer supported. Please let us know if this is still a problem using Hibernate 5.2. If it is, then please create a test case reproducing your issue using the orm/hibernate-orm-5 template from https://github.com/hibernate/hibernate-test-case-templates and attach to this issue.