Bashan, in my project, we used a (Query) Filter , after we add all the elements to the collections. Something like this :
public Collection filtrarColecao(Collection collection, String hql) {
Query filterQuery = sessao.createFilter(collection, hql);
return filterQuery.list();
}
But note that this method returns a Collection, with the order set by the HQL String.
Something like :
if(_cli.getChas() != null && _cli.getChas().size() > 0) {
ArrayList chasOrdenadosDesc = (ArrayList)repositorio.filtrarColecao(_cli.getChas(), "order by datCha desc");
}
Hope this can help you.
_________________ Eduardo Carneiro
|