For you, sortBy is just like seam-gen generates sorting for you, you need to generate a complete list, not a part of the list, as the essence of the seam frame does.
t
List allResults = entityManager.createQuery("From X").getResultList();
Now, if you just want to try using this list in your sortBy, you will work like you, except. However, the disadvantage is that it will load the entire result and put into memory. Perhaps this is not what you want.
However, you should use this along with some search result, so it is already filtered based on some user input.
source share