How to calculate the average in Hibernate?

Ads
 

How to calculate the average in Hibernate?

Hi,

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

Thanks

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 >

Ads









Related Tutorials/Questions & Answers:
How to calculate the average in Hibernate?
How to calculate average of array in Java?
Advertisements
calculate average
calculate average
Calculate sum and Average in java
Calculate an average Age of my Class?
Feature of Hibernate3
How to calculate attending hours?
How to calculate days in a year
how to calculate EMI of the loan
how to calculate the price on the option box
How to calculate Date Difference in Java?
How to calculate area of rectangle
how to calculate the employee tax - JSP-Servlet
Average
How to calculate sum of HH:MM:SS Format?
how to calculate max and min - RUP
how to write weighted moving average code using 2d-array
How to calculate number of weeks in a specified month
How to calculate area of triangle
MySQL Average Command
What is the main feature of Hibernate3?
how to calculate max and min in the loop - Java Beginners
Average of Array
how to calculate salary of all the employees 10%extra then actual salary - SQL
how can i calculate loan - Java Interview Questions
struts1.2,EJB3.0 and Hibernate3 integration example application - EJB
how to find [count the number of integers whose value is less than the average value of the integers]
how to print the average of each column of 2d n*m array using java
how can you calculate you your age in daies??
Highest average score among 25 students

Ads