These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Problem obtaining List of entity & aggregate sum
PostPosted: Wed Jul 05, 2006 10:37 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 11:50 pm
Posts: 22
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.