InterviewSolution
| 1. |
What is HQL? |
|
Answer» Hibernate Query Language (HQL) is used as an extension of SQL. It is very simple, EFFICIENT, and very flexible for performing complex operations on relational databases without writing complicated queries. HQL is the object-oriented representation of query language, i.e instead of using table name, we MAKE use of the class name which makes this language independent of any database. This makes use of the Query interface provided by Hibernate. The Query object is obtained by calling the createQuery() method of the hibernate Session interface. Following are the most commonly used methods of query interface:
Example: To get a list of all records from InterviewBitEmployee Table: Query query=session.createQuery("from InterviewBitEmployee"); List<InterviewBitEmployee> list=query.list(); System.out.println(list.get(0)); |
|