I have this error when getting the format of a date, I adapted my date with simple date format
and I do not get my result:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 2017 near line 1, column 101 [SELECT v FROM com.sa.model.crm.Offer v WHERE 1 = 1 AND v.typeOfferent = 0 AND v. Interview date 2017-00-07] at org.hibernate.hql.ast.QuerySyntaxException.convert (QuerySyntaxException.java:31) at org.hibernate.hql.ast.QuerySyntaxException.convert (QuerySyntaxException.java:24) at org.hibernate. hql.ast.ErrorCounter.throwQueryException (ErrorCounter.java:59) at
This is my method:
public void FiltrarPorTipo (){
Date d = getFechaDeEntrevista();
SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd");
String d2 = format.format(d);
System.out.println(d2);
hql = "SELECT v FROM Oferente v WHERE 1 = 1";
hql +=(getTipoOferente() != null)? " AND v.tipoOferente= "+ getTipoOferente():"";
hql +=(getFechaDeEntrevista()!= null)? " AND v.fechaDeEntrevista "+ d2:"";
oferentePorTipoDias = entityManager.createQuery(hql).getResultList();
System.out.println("************ Consulta: " + hql);
dtRp.put("oferentePorTipoDias", oferentePorTipoDias);
}