I have this method:
public List<LoteEnvEntity> findallByDate(java.util.Date dataDe, java.util.Date dataAte) {
String strQuery = "SELECT L FROM LoteEnvEntity as L WHERE 1=1";
//SimpleDateFormat simpledate = new SimpleDateFormat("yyyy-dd-MM");
Query query = getEntityManager().createQuery(strQuery);
if (dataDe != null)
{
strQuery += " and L.dateEnvio >= :dataDe";// + simpledate.format(dataDe);
query.setParameter(":dataDe", dataDe);
}
if (dataAte != null)
{
strQuery += " and L.dateEnvio <= :dataAte"; //+ simpledate.format(dataAte);
query.setParameter(":dataAte", dataAte);
}
return (List<LoteEnvEntity>) query.getResultList();
}
In the console, an error appears in the convert date as the date comes in the following format: "Wed Nov 05 00:00:00 BRST 2014". I need to use it in the Entity select , as you can see I already tried to use SimpleDateFormat
.