Iterating Object Array in Hibernate

Tagged:  

Hibernate queries sometimes return tuples of objects in which each tuple is returned as an array. This kind of results are considered scalar. This is how to iterate this kind of query result in hibernate.

Iterator itr = session.createSQLQuery
	("select * from table").list().iterator();

while(itr.hasNext()){
	 Object[] row = (Object[]) itr.next();

	 System.out.println(row[0]);
	 System.out.println(row[1]);
         System.out.println(row[2]);
}

Hibernate + Core Java is not equal to Iterating Object Array in Hibernate.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.