---
title: "hibernate实现多表关联查询的例子"
author: "lindakun"
date: "2011-12-28T16:05:47Z"
tags: ["Hibernate", "Spring", "SpringMVC", "hql", "多表关联"]
categories: ["企业架构"]
slug: "hibernate"
draft: false
lastmod: "2011-12-28T16:05:47Z"
id: 1328702
url: "https://lindakun.iteye.com/blog/1328702"
---

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