-->
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: Aggregated query problem
PostPosted: Sat May 03, 2008 12:15 pm 
Beginner
Beginner

Joined: Sun Aug 12, 2007 11:22 am
Posts: 44
Location: Sweden
Hi! I have a problem with aggregation and Criteria.

In my Item class I have a discount and a price. The Item class has a reference to a Collection class that also has a discount.

I want to be able to get the total price of all items and if the item has a disount ie != 0 then the price needs to be multiplied by the item disount else it should be multiplied by the collection disount.

I know I can do Projections.ProjectionList() and add a Sum projection but how can I accomplish the above aggregated function?

The query need to be done with criteria API because I have a lot of filters that is done before the Projection.

Any clues?


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.