第一种情况
String hql = "from Student s left join Clazz c on s.claasId=c.id "
List<Object> object = (List<Object>) this.hibernateTemplate.find(hql);
for (Object obj : object) {
Object[] objArr = (Object[]) obj;
Student s = (Student ) objArr[0];
Clazz c = (Clazz) objArr[1];
}
第二种情况
String hql = " select s.name,s.age,c.name from Student s left join Clazz c on s.claasId=c.id "
List<Object> object = (List<Object>) this.hibernateTemplate.find(hql);
for (Object obj : object) {
Object[] objArr = (Object[]) obj;
String name = (String) objArr[0];
Integer age = (Integer) objArr[1];
String className= (String) objArr[2];
}