Johan,
Code:
Query q = session.createQuery("SELECT co.countryCode, st.storeNo FROM net.sf.hibernate.Country co, net.sf.hibernate.Store st WHERE co.countryCode=st.countryCode AND co.countryCode='DK'");
List list = q.list();
System.out.println("Found " + list.size() + " matching search criteria");
Iterator listIter = list.iterator();
as I rember the list that you got via the code above, should contains elements of Object[2] array type, try the following:
Code:
List list = q.list();
for (Iterator i = list.iterator(); i.hasNext();)
{
Object[] obj = (Object[]) i.next();
String countryCode = (String) obj[0];
Integer storeNo = (Integer) obj[1];
}
I don't remember, but if Object[] obj = (Object[]) i.next(); throws ClassCastException, try List obj = (List) i.next();
Use your debugger with watch i.next().getClass().getName();
Best regards,
Leonid