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

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即值对象,里面必须要有对应的构造方法

 

你可能感兴趣的:(spring,HQL,Hibernate,springMVC,多表关联)