I have this sql query
Code:
<sql-query name="getStudentNameAndAddressStreet" >
select s.STUDENT_NAME as student_name, a.ADDRESS_STREET as address_street
from STUDENT s , ADDRESS a
where s.STUDENT_ADDRESS = a.ADDRESS_ID
</sql-query>
Now it return an object[], and I cicle it :
Code:
List<Object[]> resList = session.getNamedQuery("getStudentNameAndAddressStreet" ).list();
for (Object[] row: resList) {
System.out.println( row[0] + " "+ row[1] );
}
I'd like have an hashmap so I'll can:
Code:
List resList = session.getNamedQuery("getStudentNameAndAddressStreet" ).list();
for (HashMap row: resList) {
System.out.println( row.get("student_name") + " "+ row.get("address_street") );
}