1
How can I order 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();
}
and 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 have some way to make one "Order By" or something else?
Thank you very much, it worked out that’s what I was looking for :D
– Leandro Santos