Good afternoon , I need to filter a query by date, the date is defined in the database as: y: m: d. It 's performed with sqlnativo in hibernate but it returns null. anyone can help me , also if someone can explain me how to handle criteria with dates, since I do not find any clear example
Query query = session.createSQLQuery("Select id,fecha,total,idEnvio FROM VENTA_CABECERA vc WHERE date(fecha) = :fec" ).addEntity(HeadSale.class);
query.setParameter("fec", date);
return query.list();
It can also be the between clause , but honestly I can not make it work. would be grateful to give me a solution. regards