Hibernate HQL Query Language

Hibernate HQL Query Language

Hibernate HQL Query Language is one of the query language in the form object object relation mapping query.

In the hibernate data base operations are two types they are

  1. Single row operations
  2. Bulk operations

By using save(), load(), update() method, we can perform single row operation.

In hibernate there are three ways to perform bulk operations they are

  1. HQL (Hibernate Query Language)
  2. Criteria API
  3. Native SQL

HQL Query Language Features

  1. Hibernate queries are database independent queries. So that we can develop persistent logic by using HQL
  2. HQL queries will be written by using pojo class and pojo class member variable
  3. HQL queries very much similar to sql queries. So learning time of HQL is very less.
  4. HQL queries are case in-sensitives but pojo class and member variables are case sensitive.
  5. HQL queries will be converted into SQL queries.
  6. HQL supports operations, expressions, aggregate functions, sub queries, inner queries and so on..
  7. HQL queries allows place holders.
  8. By using HQL we can perform insert, update, delete and select operations. So we can perform DML but we can not perform DDL.

IF you are writing HQL queries we can use the pojo class name instead of table name and we can use pojo class member variables instead of column names.



  1. Select * from STUDENT( table name);
  2. select * from STUDENT where FIRSTNAME like ‘r%’;
  3. select * from STUDENT as sb where sb.hid>100 and sb.hid<200;
  4. select HID,SFIRSTNAME from STUDENT;


  1. from studentBean(pojo class);
  2. from studentBean(pojo class) where sfirstname(pojo class variable) like ‘r%’;
  3. from studentBeansb where sb.hid>100 and sb.hid<200;
  4. select hid,sfirstname from studentBean



The Author


Hello! I am Narayanaswamy founder and admin of narayanatutorial.com. I have been working in IT industry more than 7 years. NarayanaTutorial is my web technologies blog. My specialties are Java / J2EE, Spring, Hibernate, Struts, Webservices, PHP, Oracle, MySQL, SQLServer, Web Hosting and Website Development. I am a self learner and passionate about training and writing. I am always trying my best to share my knowledge through my blog.

Leave a Reply