HQL - How it is different from SQL ?

The Hibernate Query Language


What are the main differences between HQL and SQL ?

Replies

  • nareshkumar6539
    nareshkumar6539
    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

    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

    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.

You are reading an archived discussion.

Related Posts

Share it by some funny quotes . . .
Yesterday I was talking with my friend, who is also about to graduate [from different locality] & he was telling me that he has spent lots of amount in books...
The whole point behind an online community is to talk. We log-in here daily to participate in the discussions. We should be here to initiate discussions and express thoughts on...
The mysteries of the Puma Punku ruins in South America are explored. Investigators tap into forensic evidence and computer tests to study whether aliens may have inhabited this sophisticated complex....
Edward Glassman, PhD was the President of the Creativity College®, a division of Leadership Consulting Services, Inc., and Professor Emeritus of the University of North Carolina at Chapel Hill, where...