Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Hibernate How to calculate the average in Hibernate?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
How to calculate the average in Hibernate?
2 Answer(s)      7 months ago
Posted in : Hibernate


Hi,

I have to calculate the average in Hibernate. How to calculate the average in Hibernate?

Thanks


Advertisement
View Answers

January 22, 2014 at 12:34 PM


Hi,

You can use the project in Hibernate. Here is the example code of calculating the average on the fee field in database:

Projections.avg("fee")

Check the tutorial for complete code example at Hibernate criteria avg.

Thanks



January 23, 2014 at 6:27 PM


In HQL query you can use the database avg() function to calculate average

select avg(pojo property name) from <Pojo class name >



Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com