How can I sort a List with java and Hibernate?
I have an abstract class with this method
public List<T> listarContas(String where) {
String consulta = "FROM " + entityClass.getSimpleName()+ " where "+ where;
Query query = getEntityManager().createQuery(consulta);
return query.getResultList();
}
I have the controller with this method that calls the list
public List<Usuario> getListaUsuariosAtivados(){
listaUsuarios = usuarioFacade.listarContas("(situacao) = 'Ativo'");
return listaUsuarios;
}
I'm using Java, Hibernate, MySql, and Primefaces.
Would you have any way to do an "Order By" or something else?