Hello,
I have a method with 2 arguments, 1st a list of ids, 2nd a criteria. I need to retrieve the entities using the passed criteria but in the same order of the ids in the idList argument.
Code:
public class User{
private Long id;
....}
Code:
public List<User> getUsers(List<Long> idList, Criteria criteria){
List<User> results=criteria.add(Restrictions.in("id",idList)).list();
return results;
}
The problem is that the returned list does not respect the id order in the idList argument. What should be done to retrieve the entities in the same order?