You are on page 1of 1

HQL: The Hibernate Query Language

Queries may return multiple objects and/or properties as an array of type

or as an actual type-safe object

assuming that the class has an appropriate constructor.

15.5. Aggregate functions


HQL queries may even return the results of aggregate functions on properties:

Collections may also appear inside aggregate functions in the clause.

The supported aggregate functions are



The and keywords may be used and have the same semantics as in SQL.

15.6. Polymorphic queries


A query like:

returns instances not only of , but also of subclasses like . NHibernate queries may name any
.NET class or interface in the clause. The query will return instances of all persistent classes that extend
that class or implement the interface. The following query would return all persistent objects:

The interface might be implemented by various persistent classes:

NHibernate 5.2 147

You might also like