NHibernate group by named parameters doesn't work with repeated parameters
My query in HQL is basically:
select functionA(a, :paramA), functionB(b, :paramB), functionC(c, :paramC), sum(d)
from tableA
groupby by functionA(a, :paramA), functionB(b, :paramB), functionC(c, :paramC)
However this gets turned into SQL of
select functionA(a, @param0), functionB(b, @param1), functionC(c, @param2), sum(d)
from tableA
groupby by functionA(a, @param3), functionB(b, @param4), functionC(c, @param5)
Now obviously this is going to throw a 'blah' is invalid in the select list because....
error as the group by clause doesn't match the select clause. I'm about to change this to a string format so I can get on with some productive work but if anyone has 开发者_JAVA技巧the answer as to why NHibernate will not reuse the same named query input the 2 times it is used that would be much appreciated.
A similar question seems to have been asked here with no real answer either.
This has been solved in NHibernate 3.0.0.Alpha1. You can get it here
精彩评论