From the course: Java Database Access with Hibernate

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Hibernate Query Language (HQL)

Hibernate Query Language (HQL) - Java Tutorial

From the course: Java Database Access with Hibernate

Start my 1-month free trial

Hibernate Query Language (HQL)

- [Narrator] I'm sure most of you are familiar with SQL, the structured query language used to access a database. Well, the Hibernate framework has its own SQL. It is called Hibernate Query Language or HQL. Hibernate is set up to allow programmers to use native SQL but it provides a fairly easy alternative called HQL. You might want to think of HQL as the object-oriented version of SQL. HQL adds a layer of abstraction for the programmer. What does that mean? That means that the program does not necessarily need to change if the underlying database structure changes. This is a big advantage than using straight SQL. HQL works with persistent objects and their properties. Behind the scenes, HQL queries are translated by Hibernate into conventional SQL queries which in turn perform the actions on the database. Although you can use SQL statements directly with Hibernate using native SQL, I would recommend to use HQL whenever possible to avoid any database portability hassles. For example…

Contents