HQL - How it is different from SQL ?

K!r@nS!ngu

K!r@nS!ngu

@kr-at-nsngu-XqzcfU Oct 27, 2024
The Hibernate Query Language


What are the main differences between HQL and SQL ?

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • nareshkumar6539

    nareshkumar6539

    @nareshkumar6539-BKuVbx Mar 18, 2012

    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%';
  • Catherine Pillay

    Catherine Pillay

    @catherine-NESWwz Jan 12, 2019

    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.
  • Catherine Pillay

    Catherine Pillay

    @catherine-NESWwz Jan 12, 2019

    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.