|
From: NHibernate J. <nh...@gm...> - 2009-06-14 18:03:18
|
[ http://nhjira.koah.net/browse/NH-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18215#action_18215 ]
William Chang commented on NH-738:
----------------------------------
Please support generics in HQL (e.g. select new), because I use it for many form elements like dropdownlist. I find it cumbersome to create a class for pair values returned from HQL.
For example, using Castle ActiveRecord and Hibernate Query Language:
SimpleQuery<KeyValuePair<int, String>> q = new SimpleQuery<KeyValuePair<int, String>>(typeof(List), @"
select new KeyValuePair<int, String>(o.listId, o.listName) from List o
");
return q.Execute();
Error Exception:
NHibernate.Hql.Ast.ANTLR.QuerySyntaxException: Exception of type 'Antlr.Runtime.MismatchedTokenException' was thrown. [
select new System.Collections.Generic.KeyValuePair<int, String>(o.listId, o.listName) from Vendorsoft.Data.Models.List o
]
> HQL select new generics support
> -------------------------------
>
> Key: NH-738
> URL: http://nhjira.koah.net/browse/NH-738
> Project: NHibernate
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.2.0.Beta1
> Reporter: Mike Nichols
> Priority: Major
>
> Given class Pair<int,string> that has a constructor Pair(int i, string s), HQL fails to parse out the generic parameter tokens when trying the following expression: 'select new Pair<int,string>(p.Id,p.Name) from Person p'
> The <import/> is used to pull in this custom Pair class.
> The default error " , expected in SELECT ..." appears, but this is misleading.
> Actually, the tokens in the QueryTranslator class' ConcreteQueries() method aren't parsed correctly when generic "<>" symbols are present in the query. It reads the comma in the generic parameter list as a field separator and doesn't recognize the less-than/greater-than symbols.
> Seems like this could be a powerful and (simple?) improvement ...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://nhjira.koah.net/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
|