aspose file tools*
The moose likes Object Relational Mapping and the fly likes How to use Airthmetic operator in Hibernate query Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "How to use Airthmetic operator in Hibernate query" Watch "How to use Airthmetic operator in Hibernate query" New topic
Author

How to use Airthmetic operator in Hibernate query

bvikram singh
Greenhorn

Joined: Jul 30, 2005
Posts: 1
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use Airthmetic operator in Hibernate query
 
Similar Threads
MySql to HQL
A query regarding using GROUP BY using Oracle as DataBase
Getting totals of rows in SQL
Problem using alias for columns in a query JPA
Converting Negative value to zero