Chapter 6. Querying

In this chapter, we will cover the following recipes:

  • Working with an alias
  • Performing aggregate operations
  • Executing a subquery using a criteria
  • Executing a native SQL query
  • Executing a query using HQL
  • Using a formula in hibernate
  • Working with NamedQuery

Introduction

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 ...

Get Java Hibernate Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.