Tengo este error al obtener el formato de una fecha, adapté mi fecha con simple date format
y no obtengo mi resultado:
org.hibernate.hql.ast.QuerySyntaxException: unexpected token: 2017 near line 1, column 101 [SELECT v FROM com.sa.model.crm.Oferente v WHERE 1 = 1 AND v.tipoOferente= 0 AND v.fechaDeEntrevista 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
Este es mi método:
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);
}