[hibernate-issues] [Hibernate-JIRA] Resolved: (HHH-3216) Incorrect parse result in ParameterParser

Steve Ebersole (JIRA) noreply at atlassian.com
Tue Sep 16 12:01:04 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole resolved HHH-3216.
---------------------------------

    Resolution: Fixed

> Incorrect parse result in ParameterParser
> -----------------------------------------
>
>                 Key: HHH-3216
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3216
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-hql
>    Affects Versions: 3.2.6
>         Environment: Hibernate 3.1.0, 3.2.6
> Any type of database 
>            Reporter: alexandia
>            Assignee: Steve Ebersole
>             Fix For: 3.2.x, 3.3.x, 3.4
>
>
> A very simple hql will cause the ParameterMetadata.getOrdinalParameterDescriptor() method throw this Exception: 
> "Remember that ordinal parameters are 1-based!"
> HQL:
> from User u where u.userName = ? and u.userType = 'call'
> The reason is found out to be this: ParameterParser.java
> public static void parse(String sqlString, Recognizer recognizer) throws QueryException {
> 	boolean hasMainOutputParameter = sqlString.indexOf( "call" ) > 0 &&
> 		sqlString.indexOf( "?" ) < sqlString.indexOf( "call" ) &&
> 		sqlString.indexOf( "=" ) < sqlString.indexOf( "call" );
> The hql above match these conditions, so the hasMainOutputParameter is set to true.
> Thus the first normal ordinal parameter is bypassed, exception is thrown.
> Suggestion: Strenthen the checking of the hasMainOutputParameter.

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