[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2744) QueryException raised for valid SQL query - problems with aliases parsing
Michal Jastak (JIRA)
noreply at atlassian.com
Wed Jul 25 10:08:52 EDT 2007
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27608 ]
Michal Jastak commented on HHH-2744:
------------------------------------
You are wrong, this SQL Query is absolutely correct, see below:
mysql> select count(distinct v.id) from some_table v left join other_table p on v.id = p.foreign_id where upper(v.last_name) like upper('{%');
+----------------------+
| count(distinct v.id) |
+----------------------+
| 0 |
+----------------------+
1 row in set (0.13 sec)
we are not building it anyhow, it is just something like this:
... getSession().createSQLQuery(... and the query string here, same as the one run directly from mysql console ...);
we are not asking for explanations here, rather solving the broken Hibernate code ...
> QueryException raised for valid SQL query - problems with aliases parsing
> -------------------------------------------------------------------------
>
> Key: HHH-2744
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2744
> Project: Hibernate3
> Issue Type: Bug
> Affects Versions: 3.2.1
> Environment: Tomcat 5.5, Hibernate Annotations 3.3.0 ga
> Reporter: Michal Jastak
>
> 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)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list