Hi,
First i'm a beginner with the QueryOver
I have some problems to specifiy eager fetch mode with QueryOver
group.
I have two class (Northwind samples)
- Customer
- Order with a many-to-one association with Customer
and OrderCustomerSummary as DTO
public class OrderCustomerSummary
{
public Customer Client { get; set; }
public decimal Total { get; set; }
public Int64 Nb { get; set; }
}
I want to query Order with Customer group by , with count(..) and
sum(...) and use AliasToBean mechanism to put in an
IList<OrderCustomerSummary> like this.:
....
OrderCustomerSummary _customerSummary=null;
IList<OrderCustomerSummary> _list =
mSession.QueryOver<Order>()
.Fetch(pO => pO.Customer).Eager
.SelectList(pList => pList
.SelectGroup(pO =>
pO.Customer).WithAlias(()=> _customerSummary.Client )
.SelectSum(pO =>
pO.Freight).WithAlias(() => _customerSummary.Total)
.SelectCount(pO=>pO.Freight).WithAlias(()
=> _customerSummary.Nb)
)
.TransformUsing(Transformers.AliasToBean<OrderCustomerSummary>())
.List<OrderCustomerSummary>();
...
And when I iterate thru the results , i get N+1 Select problem, even i
specify eager fetch for "Customer".
Is there another way to do it to make eager fetch to work ?
Thanks for any help.
Willy
--
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.