[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2744) QueryException raised for valid SQL query - problems with aliases parsing

Neil Buesing (JIRA) noreply at atlassian.com
Sun Jan 23 15:59:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39752#action_39752 ] 

Neil Buesing commented on HHH-2744:
-----------------------------------

I don't understand why this will not be fixed. An alias (as far as I can see) cannot be defined within a quoted string within a sql query.  So, why not fix the parser so it doesn't try to balance check {} if the {} are within a quoted literal in the query.

Native query handling should be as close to pure SQL as possible.  I understand that the alias syntax changes that, but this seems to be something that could easily be fixed.

> QueryException raised for valid SQL query - problems with aliases parsing
> -------------------------------------------------------------------------
>
>                 Key: HHH-2744
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2744
>             Project: Hibernate Core
>          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