ITeye博客

hibernate实现多表关联查询的例子

lindakun · 2011-12-28 16:05 · 企业架构 · Spring · Hibernate · SpringMVC · hql · 多表关联 · Markdown

hibernate实现多表关联查询的例子:

1.HQL语句:

select new cn.u6.contoller.bean.UserBean(model1.userId,model1.userName,model1.passWord,model1.isEnable,model2.groupName) from User as model1, Group as model2, UserGroup as model3 where model1.userId=model3.userId and model3.groupId=model2.groupId

 

2.UserBean相当大家所说的VO即值对象,里面必须要有对应的构造方法

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。