[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5539) ParameterParser does not support escaped ' symbols

Gail Badner (JIRA) noreply at atlassian.com
Mon Jan 10 18:46:05 EST 2011


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

Gail Badner commented on HHH-5539:
----------------------------------

I believe the problem is that Hibernate interprets ':' in a query as the start of a placeholder for a paramter.

Please try escaping ':' as in "select * from a where a.b = 'asdf \' asdf\: '" .

> ParameterParser does not support escaped ' symbols
> --------------------------------------------------
>
>                 Key: HHH-5539
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5539
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-sql
>    Affects Versions: 3.6.0.Beta4
>         Environment: 3.6.0 and postgresql 8.2.1
>            Reporter: Alexey Romanchuk
>   Original Estimate: 2h
>  Remaining Estimate: 2h
>
> I create native SQLQuery with createSQLQuery method.
> Looks like ParameterParser incorrectly process queries with escaped ' symbol. For example query like "select * from a where a.b = 'asdf \' asdf'" works fine, but "select * from a where a.b = 'asdf \' asdf: '" fails with 
> org.hibernate.QueryException: Space is not allowed after parameter prefix ':' 'select * from a where a.b = 'asdf \' asdf''
> 	at org.hibernate.engine.query.ParameterParser.parse(ParameterParser.java:92)
> 	at org.hibernate.engine.query.ParamLocationRecognizer.parseLocations(ParamLocationRecognizer.java:75)
> 	at org.hibernate.engine.query.QueryPlanCache.buildNativeSQLParameterMetadata(QueryPlanCache.java:149)
> 	at org.hibernate.engine.query.QueryPlanCache.getSQLParameterMetadata(QueryPlanCache.java:79)
> 	at org.hibernate.impl.AbstractSessionImpl.createSQLQuery(AbstractSessionImpl.java:146)
> 	at org.hibernate.impl.SessionImpl.createSQLQuery(SessionImpl.java:1656)

-- 
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