[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3216) Incorrect parse result in ParameterParser
alexandia (JIRA)
noreply at atlassian.com
Fri Apr 4 03:45:33 EDT 2008
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