• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use Airthmetic operator in Hibernate query

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic