public List <Employee> getEmployees (final Set <String> employeeCodes)
{
List <Employee> workers = (List <Employee>) getHibernateTemplate (). execute (new HibernateCallback () {
public Object doInHibernate (sessão final da sessão) lança HibernateException, SQLException
{
{
critérios de critérios finais = session.createCriteria (Employee.class);
if(employeeCodes.size() > 1000){
final Set<String> codes = new HashSet<String>();
Disjunction disjuntion = Restrictions.disjunction();
for(Iterator<String> iterator = employeeCodes.iterator(); iterator.hasNext();){
if(codes.size() < 1000){
codes.add(iterator.next());
}else{
criteria.add(disjuntion.add(Restrictions.in("employeeCode",codes)));
codes.clear();
}
}
}else{
criteria.add(Restrictions.in("employeeCode",employeeCodes));
}
return criteria.list();
}
}
});
return employees;
}