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 the price on the option box
how to calculate EMI of the loan
How to calculate area of rectangle
How to calculate Date Difference in Java?
How to calculate sum of HH:MM:SS Format?
Average
How to calculate area of triangle
What is the main feature of Hibernate3?
MySQL Average Command
Average of Array
Highest average score among 25 students
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 to calculate minimum in Hibernate using the min() Function
how to calculate addition of two distances in feets and inches using objects as functions arguments
ModuleNotFoundError: No module named 'average'
sum and average of grades
Hibernate criteria average Example
calculate reward points.
Student average
How automatically calculate age based on date of birth and current date using jsp and servlet?
ModuleNotFoundError: No module named 'calculate'

Ads