Update,
I've just downloaded NHibernate 1.2.0 alpha, and my original problem (with the aggregate query) still exists.
The problem is this:
This is how my HQL looks like:
Code:
select sum (ol.NumberOfItems * ol.ArticlePrice)
from Order o, OrderLine ol, Customer c " +
where ol.OwningOrder = o and o.OwningCustomer = c "
and c.Id = :custId and o.OrderDate >= :orderDate
NHibernate translates this HQL to the following SQL (only the interesting part is pasted here :) ):
Code:
select sum(orderline1_.NumberOfItems*orderline1_.ArticlePrice) as x0_0_ from ...
Then, NHibernate gives me an exception that says the field with the name x1_0_ cannot be retrieved.
Offcourse not, there is no field x1_0_. You -nhibernate- called it x0_0_ ...
This is very annoying. Now, I always have to work around this, and mostly it is not very performant.
So, I try to work around it using a native SQL query, but there, I'm stuck with this 3rd parameter... what should I give as 3rd parameter (classtype) when I do not want to return a mapped class ?
I've created a ticket for it a while ago...
http://jira.nhibernate.org/browse/NH-555