The largest Interview Solution Library on the web

Hibernate Tutorials/
« Previous | 1 | 2 | 3 | Next »
The SELECT clause provides more control over the result set than the from clause. If you want to obtain few properties of objects instead of the complete object, use the SELECT clause. Following is the simple syntax of using SELECT clause to get just first_name field of the Employee object:

String hql ="SELECT E.firstName FROM Employee E";
Query query =session.createQuery(hql);
List results =query.list();

It is notable here that Employee.firstName is a property of Employee object rather than a field of the EMPLOYEE table.
« Previous | 1 | 2 | 3 | Next »

copyright © 2014 - all rights riserved by