Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Object Relational Mapping and the fly likes Avg(...) aggregate function Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Avg(...) aggregate function" Watch "Avg(...) aggregate function" New topic

Avg(...) aggregate function

subhashchandra medhiassam
Ranch Hand

Joined: Sep 10, 2008
Posts: 72
Dear friends,
I would like to know how to use the avg(...) aggregate function available in hibernate. Kindly help me with some simple example.

Thanks in advance,
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
select avg(e.salary) from Employee e
subhashchandra medhiassam
Ranch Hand

Joined: Sep 10, 2008
Posts: 72
Thanks. But i would like to know how to execute the query and retrieve the result of the avg(...) function. Kindly help.

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Here is the best place to start. Have a read of the chapter on Querying.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Avg(...) aggregate function
Similar Threads
HQL: How to count green eye kittens?
Answers of Sun's Free Proficiency Assessment
SQL Having Clause
Difference Between count() and size
question about aggregate function