Query Facilities
Powerful object-oriented query language
Queries expressed in a familiar-looking SQL-like language
- Table joins expressed as property paths
- Support for SQL functions and operators
- Support for SQL aggregate functions sum, avg, min, max, count
- Support for left|right outer join, full join
- Support for group by, having and order by
- Support for subqueries (on databases wich support SQL subselects)
- Queries may return tuples of objects or scalar values (projection)
- Support for returning arbitrary data objects via the select new construct
- Dynamic association fetch strategies using the fetch keyword
Full support for polymorphic queries
Queries may specify any abstract superclass or interface; from java.lang.Object will return all persistent objects, for example.
Bulk update/delete by query
- efficient bulk UPDATE and DELETE for all inheritance mapping strategies
- [Hibernate 3.1] support for INSERT ... SELECT ...
EJB-QL 3.0
HQL is a superset of the standard ORM query language defined by EJB 3.0
Flexible Criteria queries
Alternative object-oriented "query by criteria" API
- full support for association navigation
- runtime fetch profiles (dynamic outer join fetching)
- projection, aggregation, grouping
- subqueries
- extensible Criterion framework
- powerful query by Example API, can be mixed with Criteria
Native SQL queries
Queries expressed in the native SQL dialect of the underlying database may return managed entities, or simple scalar results
Efficient query result set pagination
Query pagination is applied at the database-level, using dialect-specific SQL
Support for cursors
Query results may be accessed using a scrollable result set
Collection filters
- queries upon collection elements
- load a subset of collection elements
- efficiently aggregate collection elements
- collection pagination