我有同样的问题..我写了这个查询
Query sqlquery = session.createQuery("select c.courseName,f.facultyID,f.facultyName,f.facultyEmailID,f.facultyContactNo,s.subjectName from com.bean.CourseBean as c,com.bean.FacultyBean as f,com.bean.Faculty_SubjectBean as fs,com.bean.SubjectBean as s where f.facultyID=fs.facultyBean.facultyID AND s.subjectID=fs.subjectBean.subjectID AND c.courseID=f.courseBean.courseID AND collegeid=1");
我返回了对象列表,并在我写的 servlet 中,
java.util.List objList=objFacultyService.listFaculty_sql(1);
java.util.List<Temp> objtemp = new ArrayList<Temp>() ;
for (Object[] objects : objList)
{
Temp temp = new Temp();
temp.setFacultyEmailID(objects[3].toString());
temp.setCourseName(objects[0].toString());
if(objects[4]==null)
{
temp.setFacultyContactNo(1);
}
else
{
temp.setFacultyContactNo(Long.parseLong(objects[4].toString()));
}
temp.setFacultyID(Long.parseLong(objects[1].toString()));
temp.setFacultyName(objects[2].toString());
temp.setSubjectName(objects[5].toString());
objtemp.add(temp);
}