本文主要是介绍HQL语句多表联合查询的视图,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
HQL语句多表联合查询
StringBuilder hqlsb1=new StringBuilder("select distinct f from TSFunction f,TSRoleFunction rf,TSRoleUser ru ").append("where ru.TSRole.id=rf.TSRole.id and rf.TSFunction.id=f.id and ru.TSUser.id=? ");StringBuilder hqlsb2=new StringBuilder("select distinct c from TSFunction c,TSRoleFunction rf,TSRoleOrg b,TSUserOrg a ").append("where a.tsDepart.id=b.tsDepart.id and b.tsRole.id=rf.TSRole.id and rf.TSFunction.id=c.id and a.tsUser.id=?");List<TSFunction> list1 = systemService.findHql(hqlsb1.toString(),user.getId());List<TSFunction> list2 = systemService.findHql(hqlsb2.toString(),user.getId());
这篇关于HQL语句多表联合查询的视图的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!