I am using session.list() to retrieve data from DB table. Every item in the returned List is an Object[], so I need to use get[index] method to retrieve a value for the particular field. However I would prefer to use "getPropertyName" methods to obtain values for the particular fields.
Is there any way to do that?
here is my code :
[b]Iterator iter = session.createQuery("select id,description,ref1, ref2,ref3 from HibernateTest ht order by ref1").iterate();
while( iter.hasNext()){
Object[] record = (Object[])iter.next();
System.out.println("ID : " + record[0]);
.....
System.out.println("ID : " + record[10]);
}[/b]
|