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

Christian Bauer (JIRA) noreply at atlassian.com
Wed Jul 25 10:20:52 EDT 2007


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

Christian Bauer commented on HHH-2744:
--------------------------------------

{ is a reserved placeholder in a query String if executed with the Hibernate API. Don't concat it onto your query string, use "like upper(:foo)" and query.setParameter("foo", "{%"). Now go to the user forum.


> 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