1
Well, I’m having a problem ordering a query, where I’m passing the name of the field along with ASC or DESC as parameter for the query, however Hibernate is not finding itself, returning the query without sorting. Someone would have a solution for this problem?
Follow the code:
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);
Thanks in advance.