class Department {
String name;
List<Employee> employees;
}
class Employee {
int age;
}
DetachedCriteria criteria = DetachedCriteria.forClass(Department.class)
criteria .add(Restrictions.eq("name", "department"))
criteria .createAlias("employees", "e").add(Restrictions.eq(("e.age"), new Integer(20)));
Department和Employee为一对多关系,查询某个部门下员工年龄为20岁的