I am attempting to obtain an array of entity 'Task' plus an aggregate value for each entity.
My HQL query is this:
Code:
"select t.TaskId, sum(f.Amount) from ProjectRegister.Domain.Entities.Task t join t.TaskFundingList tf join tf.Funding f where t.Project.ProjectId = :projectId group by t";
The relationship here is (Task 1-M TaskFunding M-1 Funding) (Basically a many-to-many expressed as two many-to-one's)
I found that there was an outstanding Jira (
http://jira.nhibernate.org/browse/NH-528) on not being able to group by entities so I've abandoned this idea.
My question is how else would I be able to execute the above query to return an array of tasks plus a sum of each tasks funding.
The only real way I can think of is to specify all the attributes of task in the group by clause which should remove the aggregate error. This doesn't really seem like the best approach.
Regards,
Jason.