如何利用hibernate查询一个主键表和多个外键表

2025-03-03 18:08:34
推荐回答(3个)
回答1:

from 学生 st join st.班级 join st.院系
如果有条件的话
where st.班级='1班' and st.院系='计算机系'

回答2:

select s.*,c.className,d.departmentName from student s,class c,department d where s.classId = c.classId and s.departmentId = d.departmentId;

回答3:

对象里如果设了many-to-one的关系,只要查出学生对象就能导航到其它一的一方的对象的