K!r@nS!ngu
K!r@nS!ngu
Branch Unspecified
12 Jan 2019

HQL - How it is different from SQL ?

The Hibernate Query Language


What are the main differences between HQL and SQL ?
nareshkumar6539

nareshkumar6539

Branch Unspecified
7 years ago
HQL is getting information based on POJOs(classes) and its variables,where as SQL is getting information based on tabels and their columns
Eg:in hibernate you have Student(studentId,studentName(varibles)) class these class information stored in student(sid,sname(column names)) table.if you want to get total students information from table where student name contains na has substring

SQL select * from student where sname like '%na%';
HQL select * from Student s where s.studentName like '%na%';
2 months ago

Hibernate Query Language (HQL) is an object-oriented query language, similar to SQL, but instead of operating on tables and columns, HQL works with persistent objects and their properties. HQL queries are translated by Hibernate into conventional SQL queries which in turns perform action on database.

Few differences between SQL and HQL.

  • SQL is based on relational database model whereas HQL is a combination of OOPS with Relational database concept.
  • SQL manipulates data stored in tables and modifies its rows and columns while HQL is concerned about objects and its properties.
  • SQL is concerned about the relationship that exists between two tables while HQL is concerned about relation between objects.
2 months ago

Hibernate Query Language (HQL) is an object-oriented query language, similar to SQL, but instead of operating on tables and columns, HQL works with persistent objects and their properties. HQL queries are translated by Hibernate into conventional SQL queries which in turns perform action on database.

Few differences between SQL and HQL.

  • SQL is based on relational database model whereas HQL is a combination of OOPS with Relational database concept.
  • SQL manipulates data stored in tables and modifies its rows and columns while HQL is concerned about objects and its properties.
  • SQL is concerned about the relationship that exists between two tables while HQL is concerned about relation between objects.

Share this content on your social channels -

Only logged in users can reply.