public List findEmployees(Employee employee, Company company) throws HibernateException {
Example exampleEmployee = Example.create(employee);
exampleEmployee.enableLike(MatchMode.ANYWHERE);
exampleEmployee.excludeZeroes();
Example exampleCompany = Example.create(company);
exampleCompany.enableLike(MatchMode.ANYWHERE);
exampleCompany.excludeZeroes();
Session session=hibernateTemplate.getSessionFactory().getCurrentSession();
Criteria criteria=session.createCriteria(Employee.class)
.add(exampleEmployee);
.createCriteria("company")
.add(exampleCompany);
Iterator iterator = criteria.list().iterator();
while(iterator.hasNext()) {
System.out.println(iterator.next()+"+++");
}
return criteria.list() ;
}
------解决方案--------------------
不能正确查询是什么意思,还有,你是通过多找1还是1找多