Hi, I've been banging my head against the wall for a while so here goes..(class names changed to protect the innocent) I have 3 classes Employer, Employee, Manager. Each Employer has one or more Employees, each Employee has 2 Managers (districtManager and areaManager) I want to do a search for based on the name of the districtManager or areaManagers name. So I have..
Criteria c = getCurrentSession().createCriteria(Employer .class); c.createCriteria("employee"); //this where is starts to blur I want to add a Restriction that is the equivalent to... // where districtManager.name like '%blah% or areaManager.name like '%blah%';
//I can do c.createCriteria("employee").createCriteria("districtManager).add(Restrictions.like("name",blah); // and c.createCriteria("employee").createCriteria("areaManager).add(Restrictions.like("name",blah);
//BUT what I ( think) I want to do is make a disjunction of the 2 Criteria(districtManager and areaManager) . How can I do that?
|