Joining on multiple fields in a NHibernate Criteria query
I have a Dept table and a Emp table. I need to join these two table in such a way that the where clause looks something like this: where dept.deptId = emp.DeptId and dept.deptName = emp.empTrainingName I tried this: Criteria criteria = session.createCriteria(Dept.class).createAlias("empMap","id"); Using this, the first where condition i.e. dept.deptId = emp.DeptId is performed. But I am not sure how to compare dept.deptName with emp.empTrainingName . How do I do this using the Criteria API in NHibernate? Criteria criteria = session.createCriteria(Dept.class, "department") .createAlias("empMap"