发布网友 发布时间:2022-04-08 19:00
共1个回答
热心网友 时间:2022-04-08 20:30
getSession().createSQLQuery(sql).addEntity(Classes.class);追问2个基于Teacher的表都不管了?追答select c.cname,c.croom,t1.tname as t1name,t2.tname as t2name from southit_classes c left join (select * from southit_teacher where type=1) t1 on c.cno=t1.tclasses left join (select * from southit_teacher where type=2) t2 on c.cno=t2.tclasses;
getSession().createSQLQuery(sql)
.addScalar("cname",StandardBasicTypes.STRING)
.addScalar("croom",StandardBasicTypes.STRING)
.addScalar("t1name",StandardBasicTypes.STRING)
.addScalar("t2name",StandardBasicTypes.STRING)
.list();