Well, I have a problem with sorting a query, where I am passing the field name along with ASC or DESC as the query parameter, but hibernate is not finding himself, returning the query without the ordering. Would anyone have a solution to this problem?
Follow the code below:
String filtro = "nome DESC"; //ou "nome ASC"
Query query = manager
.createQuery("select t from ProdutosVO as t "+
"where t.codigoEmpresa = :paramCodigo ORDER BY :paramFiltro");
query.setParameter("paramCodigo", codigoEmpresa);
query.setParameter("paramFiltro", filtro);
Thank you in advance.