I create a function to fetch some rows that matches the Date. But the function is not performing accordingly. I suspect there is some syntax issue. Please help me finding the issue. The DaoImpl funtion is given below:
public List<ReportSewing> getReport(Date reportDate) {
return session.getCurrentSession()
.createQuery("from ReportSewing where DATE(reportDate) = (reportDate)")
.list();
}
Seems like you forgot to pass query parameter.
public List<ReportSewing> getReport(Date reportDate) {
return session.getCurrentSession()
.createQuery("from ReportSewing where DATE(reportDate) = :reportDate")
.setParameter("reportDate", reportDate)
.list();
}