例子描述查询一些班级中的学生
/**
*
* @param city
* @return
*/
public List<Student> studentList(final Integer[] classIDs) {
final String hql = "from Studentwhere classId in (:classIDs) ";
List<Student> studentList= hibernateTemplate.execute(new HibernateCallback<List<Student>>() {
@Override
public List<Student> doInHibernate(Session session) throws HibernateException, SQLException {
Query query = session.createQuery(hql);
query.setParameterList("classIDs", classIDs);
return query.list();
}
});
return studentList;
}