Code:
9.3.1. Scalar queries
Queries may specify a property of a class in the select clause. They may even call SQL aggregate functions. Properties or aggregates are considered "scalar" results.
Iterator results = sess.iterate(
"select cat.color, min(cat.birthdate), count(cat) from Cat cat " +
"group by cat.color"
);
while ( results.hasNext() ) {
Object[] row = results.next();
Color type = (Color) row[0];
Date oldest = (Date) row[1];
Integer count = (Integer) row[2];
.....
}
Iterator iter = sess.iterate(
"select cat.type, cat.birthdate, cat.name from DomesticCat cat"
);
List list = sess.find(
"select cat, cat.mate.name from DomesticCat cat"
);
[quote]
http://www.hibernate.org/hib_docs/reference/en/html/manipulatingdata.html#manipulatingdata-scalarqueries[/quote]