Hibernate Query Language (HQL)
Hibernate Query Language (HQL) is same as SQL (Structured Query Language) however it doesn't relies upon the table of the database. Rather than table name, we use class name in HQL. So it is database free inquiry language.
Advantage of HQL
There are numerous focal points of HQL. They are as per the following:
- database independent
- supports polymorphic queries
- easy to learn for Java Programmer
It is an article situated portrayal of Hibernate Query. The object of Query can be gotten by calling the createQuery() technique Session interface.
The inquiry interface gives numerous techniques. There is given ordinarily utilized methods:
- public int executeUpdate() is utilized to execute the update or erase query.
- public List list() restores the consequence of the ralation as a list.
- public Query setFirstResult(int rowno) indicates the line number from where record will be retrieved.
- public Query setMaxResult(int rowno) indicates the no. of records to be recovered from the connection (table).
- public Query setParameter(int position, Object value) it sets the incentive to the JDBC style inquiry parameter.
- public Query setParameter(String name, Object value) it sets the incentive to a named question parameter.