Hello,
I am using NHibernate 1.2.0 Alpha 1/Mssql2005-Dialect and encountered problems using the year method in a HQL query. I tried to query this:
Code:
SELECT year(t.CreationDate) FROM Task t JOIN t.Actions act group by year(t.CreationDate), month(t.CreationDate)
That did not work. I received this error message:
Quote:
undefined alias or unknown mapping: year [SELECT year(t.CreationDate) FROM AMS.Core.Domain.Task t JOIN t.Actions act group by year(t.CreationDate), month(t.CreationDate)]
Querying this works properly:
Code:
SELECT count(t) FROM Task t JOIN t.Actions act group by year(t.CreationDate), month(t.CreationDate)
Is there a possibility to do such grouping queries database independent with NHibernate or do I have to query each and every row and do the aggregation on my own? I think I would gain a lot of performance if I could let the database aggregate the data.
I hope anybody can help me. Thanks and regards,
Dominik