[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1706) Named parameters ignored when single apostrophe encountered within an SQL comment

Matthew Lieder (JIRA) noreply at atlassian.com
Mon Jan 3 16:19:05 EST 2011


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

Matthew Lieder commented on HHH-1706:
-------------------------------------

I can confirm this is a legitimate bug and still exists in 3.5.1. org.hibernate.engine.query.ParameterParser isn't aware of comments and thus treats anything inside comments as if it's actual SQL.

> Named parameters ignored when single apostrophe encountered within an SQL comment
> ---------------------------------------------------------------------------------
>
>                 Key: HHH-1706
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1706
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.1.3, 3.2.0 cr1
>         Environment: 3.1.2, DB2/400
>            Reporter: Curtis Witherow
>         Attachments: bug.zip
>
>
> Found that named parameters in an named SQL query are ignored when a single apostrophe is encountered in an SQL comment (either /* ... */ or -- ... form).
> The obvious workaround is to remove single apostrophes from SQL comments.
> I have included test code that runs two queries -- the first succeeds, the second fails. The only difference between the queries is that the second contains the apostrophe character within a comment.
> Since I was testing against DB2/400, I was using SYSIBM.SYSDUMMY1 as my source table. This is analygous to using DUAL on an Oracle db.

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