-->
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.  [ 3 posts ] 
Author Message
 Post subject: Aithmetic operator in select query - hibernate
PostPosted: Mon Aug 01, 2005 9:13 am 
Newbie

Joined: Sat Jul 30, 2005 7:44 am
Posts: 15
Hi everybody,I am writing a hibernate query that multiply two attributes and takes it sum, but when I use * operator,it gives error "* only allowed inside aggregate function in SELECT " . HQL query is :

****************************************************************
Select
sum(postab.subtotal),
sum(postab.tax),
sum(postab.total),
count(postab.checknum) ,
sum((postab.subtotal)*(loc.royalty)/100) From
com.infonox.hibernate.Location as loc,
com.infonox.hibernate.Postables as postab
where loc.restaurantid = postab.restaurantid

****************************************************************

Line which is creating problem is

sum((postab.subtotal)*(loc.royalty)/100) Is there any other way to take product of two attributs? your help will be greatly appreciated as it is really stumbling block in my project. Thanks in advance


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 10:34 am 
Expert
Expert

Joined: Thu Dec 04, 2003 12:36 pm
Posts: 275
Location: Bielefeld, Germany
Why do you ask your question again?
It has already been answered by Gavin.
http://forum.hibernate.org/viewtopic.php?t=945708

As far as I know, what you'd like to do is not possible with Hibernate 2.x. Therefore, Gavin suggested to switch to Hibernate 3.

Best regards
Sven


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 01, 2005 11:13 pm 
Newbie

Joined: Sat Jul 30, 2005 7:44 am
Posts: 15
Thanks sven


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

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.