-->
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: Ordering entities by an aggregation
PostPosted: Mon Aug 03, 2009 9:23 am 
Newbie

Joined: Mon Aug 03, 2009 9:16 am
Posts: 2
Hi,

I'm in the following situation: I have Invoices, Products and ProductEntries. In my simple application I want to display the Invoices along with the sum of their ProductEntries and be able to sort them. So I'll have to order it according to the SUM of the values of the entries. My problem is that I'm unable to get Invoices from a typical SELECT ... GROUP BY, because I've to obviously group by the unique identifier. And since I wanted to build a system which accepts custom Order objects, I wanted to avoid to fetch first the IDs and then the Invoices itself, meaning I want to have only a single step.

Is this even possible?

Thanks in advance,
Daniel


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.