]
Steve Ebersole updated HHH-3216:
--------------------------------
Assignee: Steve Ebersole
Fix Version/s: 3.4
3.3.x
3.2.x
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: