Thank you! This project was a first using NHiibernate for me and I had been going down the path of using the criteria query API -- however for things like this which were less straight forward I was having a hard time finding examples online. Digging through the criteria API using intellisense is a little hit and miss!
Between your answer and the hql documentation this took about 10 minutes and is working great. On Nov 8, 8:15 am, Jason Meckley <[email protected]> wrote: > sent too soon. something like > select d.name, sum(n.amount) from event e join e.donor d join donation > n where e.id = :id order by sum(n.amount) desc > > projections will not resolve the entire donor object model, the > referenced property. > > On Nov 7, 10:25 pm, Rob Walker <[email protected]> wrote: > > > > > > > > > I have 4 tables: organization, donor, event, gift with a > > relationships: donor has an organization, event has an organization, > > gift has an event and donor. > > > I want to select all donors that have donated gifts to a specific > > event ordered by their total donations. > > > Currently I can select all the active donors for an event: > > > var active_donors = > > DetachedCriteria.For<Az.Item>() > > .Add(Restrictions.Eq("Event", current_event)) > > .SetProjection(Projections.GroupProperty("Donor")); > > > IList<Donor> donors = > > Session.CreateCriteria(typeof(Az.Donor)) > > .Add(Restrictions.Eq("Organization", > > current_organization)) > > .Add(Subqueries.PropertyIn("Id", active_donors)) > > .List<Az.Donor>(); > > > But I can't work out how to include the the total donations for the > > donor, or how to order by it. > > > Any suggestions? > > > Thanks. -- 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.
