From: NHibernate J. <mik...@us...> - 2006-10-26 19:53:15
|
[ http://jira.nhibernate.org/browse/NH-738?page=comments#action_14226 ] Fabio Maulo commented on NH-738: -------------------------------- Simple.... not really. The classic HQL parse (the parse of NHb) is something hard to modify. The new AST parse of H3.2 don't support generic. I think you can solve the problem now using a class inherited from Pair<int,string>. public class IdWithValue : Pair<int,string> { public IdValueList(int id, string value):base(id,value) {..... ... } Any way this is an interesting improvement. > HQL select new generics support > ------------------------------- > > Key: NH-738 > URL: http://jira.nhibernate.org/browse/NH-738 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Mike Nichols > > 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://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: NHibernate J. <mik...@us...> - 2006-11-02 21:29:31
|
[ http://jira.nhibernate.org/browse/NH-738?page=comments#action_14281 ] Mike Nichols commented on NH-738: --------------------------------- Thanks Fabio. I had come that workaround but was hoping the parser upgrade might not be so difficult. > HQL select new generics support > ------------------------------- > > Key: NH-738 > URL: http://jira.nhibernate.org/browse/NH-738 > Project: NHibernate > Type: Improvement > Components: Core > Versions: 1.2.0.Beta1 > Reporter: Mike Nichols > > 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://jira.nhibernate.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
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 |