91-9990449935 0120-4256464 |
Hibernate Query Language (HQL)Hibernate Query Language (HQL) is same as SQL (Structured Query Language) but it doesn't depends on the table of the database. Instead of table name, we use class name in HQL. So it is database independent query language. Advantage of HQLThere are many advantages of HQL. They are as follows:
Query InterfaceIt is an object oriented representation of Hibernate Query. The object of Query can be obtained by calling the createQuery() method Session interface. The query interface provides many methods. There is given commonly used methods:
Example of HQL to get all the recordsExample of HQL to get records with paginationExample of HQL update queryExample of HQL delete queryHQL with Aggregate functionsYou may call avg(), min(), max() etc. aggregate functions by HQL. Let's see some common examples: Example to get total salary of all the employeesExample to get maximum salary of employeeExample to get minimum salary of employeeExample to count total number of employee IDExample to get average salary of each employees
Next TopicHCQL
|