This chapter shows a different functionality and an API used to query with hibernate. In this chapter, you will also learn how hibernate provides a facility to perform complex queries in an object-oriented manner.
We will discuss a number of functionalities useful while querying, such as an alias, aggregate functions, and subquery. Sometimes, we need to use a native SQL in hibernate, and you will also learn about executing it. Apart from this, you will learn HQL (Hibernate Query Language), which provides a purely object-oriented way to execute the query, NamedQuery, and formulas.