Hi,
I have to calculate the average in Hibernate. How to calculate the average in Hibernate?
Thanks
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
In HQL query you can use the database avg() function to calculate average
select avg(pojo property name) from <Pojo class name >
Ads