Selecting Partial Object with More than one Column using HQL



In this approach we are going to select partial object, (selected columns, i mean more than
one column)


In this case hibernate internally stores the multiple column values of each row into an object
array and stores these object arrays into List collection.


At the time of iterating the collection, we need to typecast the result into an object arrays
Lesson :
Query qry = session.createQuery("select e.id,e.name from Entity e");
List dataList =qry.list();
Iterator iterator = dataList.iterator();
while(iterator.hasNext())
{
       Object obj[] = (Object obj[])iterator.next();
       System.out.println("-------");
}