What is HQL (Hibernate Query Language)?

HQL (Hibernate Query Language) is Hibernate's own object-oriented query language, syntactically similar to SQL but operating on entity objects and their properties rather than tables and columns directly.

Key Points

Example

The query "from Employee e where e.salary > 50000" returns Employee entity instances directly, letting you write from Employee, not from a table name, and reference salary as a Java field rather than a SQL column.

Query<Employee> query = session.createQuery(
    "from Employee e where e.department.name = :deptName", Employee.class);
query.setParameter("deptName", "Engineering");
List<Employee> results = query.list();

Common Mistakes

Follow-up Questions

Interview Tip

A concise interview answer is

HQL is Hibernate's object-oriented query language — it looks like SQL but operates on entity classes and their properties instead of tables and columns, understands inheritance and associations, and Hibernate compiles it down to database-specific SQL underneath.

Last updated: 11 November 2026

Previous question: How does Hibernate manage transactions?

Next question: What is the Criteria API in Hibernate?

More Hibernate (Optional) interview questions

All Hibernate (Optional) questions