Thursday, 19 January 2017

Hibernate Query Language (HQL)

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.
Keywords like SELECT, FROM and WHERE etc. are not case sensitive but properties like table and column names are case sensitive in HQL
String hql = "SELECT E.firstName FROM Employee E";
Query query = session.createQuery(hql);


List results = query.list();

No comments:

Post a Comment