[hibernate-issues] [Hibernate-JIRA] Created: (HHH-1996) "ORDER BY ?" named parameter in named query ignored
W. Muir (JIRA)
noreply at atlassian.com
Fri Aug 11 14:31:19 EDT 2006
"ORDER BY ?" named parameter in named query ignored
---------------------------------------------------
Key: HHH-1996
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1996
Project: Hibernate3
Type: Bug
Components: query-sql, query-hql
Versions: 3.1.3
Environment: hibernate 3.1.3, java 1.5.0_06-b05, mysql 5.0.21
Reporter: W. Muir
a named query, that contains a named parameter in the "ORDER BY" clause is ignored/removed.
example:
<query name="test">
<![CDATA[ FROM SomeObject so WHERE 1=1 ORDER BY :order ]]>
</query>
case 1 : named parameter set
Query query = session.getNamedQuery( "test" );
query.setString( "order ", "so.id" );
List list = query.list();
// results are not ordered by id (or what ever you set for the named paraemeter)
case 2: named parameter NOT set
Query query = session.getNamedQuery( "test" );
// query.setString( "order ", "so.id" );
List list = query.list();
Exception in thread "main" org.hibernate.QueryException: Not all named parameters have been set: [order] [
FROM SomeObject so WHERE 1=1 ORDER BY :order
]
1. Should some sort of exceptioin be thrown (NotSupportedException, or something)?
2. bump this to a feature request?
Related? http://opensource.atlassian.com/projects/hibernate/browse/HB-297
--
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