From: Kelly S. (JIRA) <nh...@gm...> - 2011-06-06 18:40:09
|
Unable to order by sub-collection's count ----------------------------------------- Key: NH-2760 URL: http://216.121.112.228/browse/NH-2760 Project: NHibernate Issue Type: Bug Components: Linq Provider Affects Versions: 3.2.0Beta1 Reporter: Kelly Stuard Priority: Major (Attaching unit tests and exception shortly.) // Many-to-many association between User and UserGroup. var query = from ug in session.Query<UserGroup>() orderby ug.Users.Count() select ug; query.ToList(); // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Kelly S. (JIRA) <nh...@gm...> - 2011-06-06 19:02:11
|
[ http://216.121.112.228/browse/NH-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kelly Stuard updated NH-2760: ----------------------------- Attachment: NH2760.zip NH2760-Exception.txt > Unable to order by sub-collection's count > ----------------------------------------- > > Key: NH-2760 > URL: http://216.121.112.228/browse/NH-2760 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.2.0Beta1 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2760-Exception.txt, NH2760.zip > > > (Attaching unit tests and exception shortly.) > // Many-to-many association between User and UserGroup. > var query = > from ug in session.Query<UserGroup>() > orderby ug.Users.Count() > select ug; > query.ToList(); > // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Kelly S. (JIRA) <nh...@gm...> - 2011-06-06 19:04:17
|
[ http://216.121.112.228/browse/NH-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21267#action_21267 ] Kelly Stuard commented on NH-2760: ---------------------------------- Unit tests and exception attached. Please let me know if I can provide any additional information. > Unable to order by sub-collection's count > ----------------------------------------- > > Key: NH-2760 > URL: http://216.121.112.228/browse/NH-2760 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.2.0Beta1 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2760-Exception.txt, NH2760.zip > > > (Attaching unit tests and exception shortly.) > // Many-to-many association between User and UserGroup. > var query = > from ug in session.Query<UserGroup>() > orderby ug.Users.Count() > select ug; > query.ToList(); > // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Fabio M. (JIRA) <nh...@gm...> - 2011-06-14 14:39:24
|
[ http://216.121.112.228/browse/NH-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21289#action_21289 ] Fabio Maulo commented on NH-2760: --------------------------------- Which should be the expected SQL ? > Unable to order by sub-collection's count > ----------------------------------------- > > Key: NH-2760 > URL: http://216.121.112.228/browse/NH-2760 > Project: NHibernate > Issue Type: Bug > Components: Linq Provider > Affects Versions: 3.2.0Beta1 > Reporter: Kelly Stuard > Priority: Major > Attachments: NH2760-Exception.txt, NH2760.zip > > > (Attaching unit tests and exception shortly.) > // Many-to-many association between User and UserGroup. > var query = > from ug in session.Query<UserGroup>() > orderby ug.Users.Count() > select ug; > query.ToList(); > // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Julian M. (JIRA) <nh...@gm...> - 2011-06-14 15:35:15
|
[ http://216.121.112.228/browse/NH-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julian Maughan updated NH-2760: ------------------------------- Fix Version/s: 3.2.0Beta2 Description: // Many-to-many association between User and UserGroup. var query = from ug in session.Query<UserGroup>() orderby ug.Users.Count() select ug; query.ToList(); // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. was: (Attaching unit tests and exception shortly.) // Many-to-many association between User and UserGroup. var query = from ug in session.Query<UserGroup>() orderby ug.Users.Count() select ug; query.ToList(); // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. Issue Type: Improvement (was: Bug) Thanks for the test. I've committed a change that makes it pass. The Linq statement now generates the same SQL as the equivalent HQL statement: "select ug from UserGroup ug order by size(ug.Users)"... select usergroup0_.Id as Id2_, usergroup0_.Name as Name2_, usergroup0_.Other as Other2_ from UserGroup usergroup0_ order by (select cast(count(*) as INT) from UserGroupUsers users1_, [User] user2_ where usergroup0_.Id=users1_.UserGroupId and users1_.UserId=user2_.Id) asc Unfortunately some RDBMs may have trouble with the subquery in the ORDER BY clause. > Unable to order by sub-collection's count > ----------------------------------------- > > Key: NH-2760 > URL: http://216.121.112.228/browse/NH-2760 > Project: NHibernate > Issue Type: Improvement > Components: Linq Provider > Affects Versions: 3.2.0Beta1 > Reporter: Kelly Stuard > Priority: Major > Fix For: 3.2.0Beta2 > > Attachments: NH2760-Exception.txt, NH2760.zip > > > // Many-to-many association between User and UserGroup. > var query = > from ug in session.Query<UserGroup>() > orderby ug.Users.Count() > select ug; > query.ToList(); > // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Julian M. (JIRA) <nh...@gm...> - 2011-06-14 15:37:14
|
[ http://216.121.112.228/browse/NH-2760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Julian Maughan resolved NH-2760. -------------------------------- Resolution: Fixed Committed to trunk (r5926) > Unable to order by sub-collection's count > ----------------------------------------- > > Key: NH-2760 > URL: http://216.121.112.228/browse/NH-2760 > Project: NHibernate > Issue Type: Improvement > Components: Linq Provider > Affects Versions: 3.2.0Beta1 > Reporter: Kelly Stuard > Priority: Major > Fix For: 3.2.0Beta2 > > Attachments: NH2760-Exception.txt, NH2760.zip > > > // Many-to-many association between User and UserGroup. > var query = > from ug in session.Query<UserGroup>() > orderby ug.Users.Count() > select ug; > query.ToList(); > // Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |