Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Min, Max and Count on HQL

Does hibernate HQL queries support using select min, max, count and other sql functions?

like:

select min(p.age) from person p

Thanks

like image 466
Danmaxis Avatar asked Dec 01 '08 13:12

Danmaxis


People also ask

Can we use select * in HQL?

Keywords like SELECT, FROM, and WHERE, etc., are not case sensitive, but properties like table and column names are case sensitive in HQL.

What is the description for count () in hibernate?

Hibernate Query Language (HQL) supports the following aggregate functions in SELECT statements. Except count() , all other functions except numeric values as arguments. The count() can be used to count any kind of values, including the number of rows in the query result.


1 Answers

Yes, min(), max() and count() are supported in HQL.

see aggregate functions in the Hibernate Doc.

like image 169
Galwegian Avatar answered Nov 10 '22 06:11

Galwegian