public class Department implements java.io.Serializable {
// Fields
private Integer deptno;
private String dname;
private String loc;
private Set employees = new HashSet(0);
.................
}
public class Employee implements Serializable {
// Fields
private Integer empno;
private Department department;
private String ename;
private String job;
private Integer mgr;
private Date hiredate;
private Double sal;
private Double comm;
private String pictureuri;
....................}
Criteria cri = getSession().createCriteria(Employee.class);
cri.createAlias("department", "dept").add(Restrictions.eq("dept.dname", emp.getDepartment().getDname()));
Hibernate 多表关联查询简单实用方法
最新推荐文章于 2012-04-17 12:44:00 发布