Introduce query settings property hibernate.query.parse_java_constant which indicates whether or not parse JAVA constant for HQL query.
Introduce query settings property parse_java_constant
Thanks for your Pull Request. I don't think that a SessionFactory-level configuration is the best way to handle this issue. A Query Hint is usually a much better approach.
However, we should address the root cause of the issue here instead of bypassing the verification.
Let's see what @sebersole, @gbadner, @Naros or @dreab8 have to say about it.
I added a Pull Request with a fix that doesn't require any configuration and filters out aliases and other expressions that don't follow the Java Naming conventions for a constant expression.
I'm going to close this issue if my fix is validated.
After a peer review with @dreab8, I'm going to reuse your config so that we disable the auto-check if the user decides so.
I fixed it by skipping the aliases. Check out this commit.