QueryException raised for valid SQL query - problems with aliases parsing
Description
is duplicated by
Activity

Michal JastakJune 3, 2024 at 9:29 AM
- Let me keep suffering then, in my strange and neurodivergent way, and write the code instead of continuing this useless discussion - Thank you for fixing this issue.

Gavin KingJune 3, 2024 at 9:04 AM
I mean, that’s just a really strange and neurodivergent way of looking at the world.
Like …. this bug wasn’t affecting me in any way. Hell, I didn’t even know it existed. The only reason I care about it at all is that there are many tens of thousands of lovely people using Hibernate and I want them to have a nice experience.
So the person who suffers when you don’t contribute fixes to open source projects you use is you, Michal Jastak, since it's you who is the one affected by the bug and it’s you who has to come up with workarounds in your own code.

Michal JastakJune 3, 2024 at 8:09 AM
Nice - so I’m the bad guy - if that took one hour for you, why we have to wait for 17 years to get this fix? - I know what you’ll respond - because I haven’t provided it - sorry, but it’s you - Hibernate crew - who provided this solution to us, we can, but we don’t have to fix your bugs

Gavin KingJune 3, 2024 at 7:55 AM
I mean, I wasn’t there in 2007, I don’t know the full background, and I’m most certainly not going to criticize my colleagues who did an amazing job back then of supporting thousands and thousands of users.
But what I do know is that for the past 17 years you had the option of being a good citizen of this open source community, and proposing a fix for the bug. There were no pull requests back then, but we certainly accepted patches.
For the record, it took me less than an hour of work to fix, and required no special knowledge of the Hibernate code base. You could easily have done it.
But instead you decided to take the other path of just whining at people who are providing you with something for free and asking nothing of you in return.

Michal JastakJune 3, 2024 at 7:38 AM
I’m first reporter of this issue, and I haven’t used string concatenation - it’s probably one of your colleagues who suggested that I’m doing it without even trying to check this problem, then suggesting that I should go away, and check the forum - nice strategy for handling people who are trying to improve your product Take a look at the others' comments below - NOBODY uses concatenation here.
SQLQuery parser dose not parse queries correctly.
Trying to invoke:
session.createSQLQuery("select foo from bar where foo like '{%'");
ends with:
rg.hibernate.QueryException: Unmatched braces for alias path [select foo from bar where foo like '{%']
at org.hibernate.loader.custom.sql.SQLQueryParser.substituteBrackets(SQLQueryParser.java:74)
at org.hibernate.loader.custom.sql.SQLQueryParser.process(SQLQueryParser.java:51)
at org.hibernate.loader.custom.sql.SQLCustomQuery.<init>(SQLCustomQuery.java:110)
at org.hibernate.engine.query.NativeSQLQueryPlan.<init>(NativeSQLQueryPlan.java:43)
at org.hibernate.engine.query.QueryPlanCache.getNativeSQLQueryPlan(QueryPlanCache.java:114)
at org.hibernate.impl.AbstractSessionImpl.getNativeSQLQueryPlan(AbstractSessionImpl.java:137)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)