[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3216) Incorrect parse result in ParameterParser
alexandia (JIRA)
noreply at atlassian.com
Fri Apr 4 04:04:33 EDT 2008
[ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29938 ]
alexandia commented on HHH-3216:
--------------------------------
Is there any simple work around?
Now I just can do this:
1. Ask all to use ? instead of 'call'
2. Put the "u.userType = 'call' " criteria before the "u.userName = ?"
But you know there are tons of hql there, I wonder whether there is a better way to avoid this problem.
> Incorrect parse result in ParameterParser
> -----------------------------------------
>
> Key: HHH-3216
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3216
> Project: Hibernate3
> 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
>
> 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