Hi I would like to know how I can Achieve this: I want to remove blank spaces and lowercases a field in a select statement I tried from this question(How do I remove all spaces from a field in a Postgres database in an update query?) but I got a error.I am using EJB.
String where = "";
Map parametros = new HashMap();
where += "( lower(replace(o.nombres, ' ', '')) like :nombres and lower(replace(o.apellidos, ' ', '')) like :apellidos) ";
parametros.put("nombres", paciente.getNombres().toLowerCase().replaceAll("\\s+",""));
parametros.put("apellidos", paciente.getApellidos().toLowerCase().replaceAll("\\s+",""));
parametros.put(";whee", where);
List<Pacientes> aux = ejbPaciente.encontarParametros(parametros);
Error
Error al ejecutar la consulta : class com.medkf.entidades.Pacientes java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager: Exception Description: Syntax error parsing [Select object(o) from Pacientes as o where ( lower(replace(o.nombres, ' ', '')) like :nombres and lower(replace(o.apellidos, ' ', '')) like :apellidos) ]. [50, 77] The encapsulated expression is not a valid expression. [103, 132] The encapsulated expression is not a valid expression.
Thanks the help.