the following query fails:
var results = DetachedCriteria
.For<OrderLine>
.SetProjection(Projections
.ProjectionList()
.Add(Projections.GroupProperty("item.category"))
.Add(Projections.GroupProperty("order.sales_date"))
.Add(Projections.Sum("quantity*item.unit_factor")))
.CreateAlias("order", "order")
.CreateAlias("item", "item")
.CreateAlias("item.category", "category")
.Add(Restrictions.Between("order.sales_date", start, end))
.Add(Restrictions.Eq("order.invoiced", true))
.GetExecutableCriteria(session)
.List();
with the exception:
could not resolve property: quantity*item.unit_factor of:
SalesReports.Web.Model.Domain.OrderLine
however the following HQL works:
select
c,
h.sales_date,
sum(d.quantity*i.unit_factor)
from
OrderLine d
join d.order h
join d.item i
join i.category c
where
h.sales_date between :start and :end
and h.invoiced = true
group by
c.id,
c.sort_order,
c.name,
c.parent_category,
h.sales_date
how do I fix the projection Projections.Sum
("quantity*item.unit_factor")?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---