The parsing check for whether parameters need parens surrounding or not is broken. I have a query like:
"description in :descriptions ))"
and the way it is written, it thinks it doesn't need to surround ":descriptions" with parens because the first non whitespace char after ":descriptions" is a ). Here is a link to the code on github, and below is the code and what it should be fixed to (I forked it on Git and have included the pull request on this issue). Cheers and thanks!
https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/internal/util/StringHelper.java#L175
boolean encloseInParens = actuallyReplace && encloseInParensIfNecessary && ! ( getLastNonWhitespaceCharacter( beforePlaceholder ) == '(' ) && ! ( getFirstNonWhitespaceCharacter( afterPlaceholder ) == ')' );
Should be
boolean encloseInParens = actuallyReplace && encloseInParensIfNecessary && ! ( ( getLastNonWhitespaceCharacter( beforePlaceholder ) == '(' ) && ( getFirstNonWhitespaceCharacter( afterPlaceholder ) == ')' ) );
|