HQL, Hibernate Query Language
Posted on: October 30, 2010 at 12:00 AM
Learn about Hibernate Query Language (HQL).

HQL - Hibernate Query Language

In this tutorial on HQL we will learn how to use HQL to perform CRUD operations on the persistence Entity objects. This is complete tutorial on HQL. You will find almost all the topics related to HQL. The HQL examples discussed here will show how to use the different features of HQL. Tutorials discussed here is supported by the real world (simplified) examples that can be modified and used in the real world applications. These examples are ready to use and you can download and test it instantly.

What is HQL?

The HQL stands for Hibernate Query Language, which is inspired by the SQL and its syntax resembles SQL syntax. In case SQL we use the table names and its columns. But in case of HQL we write queries using the persistence object and it properties. The Hibernate Query Language is very powerful tool and it support inheritance and associations.

While SQL is executed on the database, HQL is written to use the Java Persistence Entity. The the Hibernate reads and parse the HQL and generates the SQL statements. These SQL statements are then executed against database. The HQL greatly simplifies the developer life. It helps the programmer to write Query using the persistence entity. The HQL is fully object oriented and it knows the inheritance, polymorphism and association principals.

In Hibernate 3, HQL supports bulk update and bulk delete operations, which is very useful. We we also show the examples of bulk update and bulk delete using HQL.

HQL allows the developers to write queries in object oriented was and the it generates and executes the SQL statements against database. Hibernate then translates the result set into Persistence entity objects.

HQL is very powerful language and it supports Project queries, Aggregation function, Grouping functions and Restrictions (with the help of different Restrictions in criteria). It is so powerful that it can be used to map the most complex SQL queries. So, you can use HQL to create complex applications. HQL also takes the advantages of Hibernate caching machinist, you can cache the expensive queries. Which enhances the performance of your application.

Prerequisite to learn HQL tutorial

There is not specific prerequisite to learn HQL, but you should know Hibernate and some experience of writing Hibernate program. If you don't know Hibernate learn it at Hibernate Tutorial page.

  1. HQL Select

Related Tags for HQL, Hibernate Query Language:

Advertisements

Ads

 
Advertisement null

Ads