I want to write a nhibernate query to get all employees who are in the given list of departments.
The senario is the employee class has the department class property.the department class has the department name in it besides other properties.I have a list of department names with me and i want all employees who belong to that department. The below is the query i tried but its not working
var employeesInGivenDepartmentList = NHibernateSessionManager.GetSession().CreateCriteria(typeof(Employee), "emp") .CreateAlias("emp.Department", "dept") .Add(Restrictions.In("dept.Name", departmentlist)) //this line not working .SetResultTransformer(new DistinctRootEntityResultTransformer()) .List(); Thanks