按下搜索按钮时出现以下错误:
发生错误:
异常 [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException 内部异常: java.sql.SQLException: Missing IN or OUT parameter at index:: 1 错误代码: 17041 调用: SELECT * FROM CRM_DAILY_SHEET WHERE to_char(reported_on,'dd-MM-yy') = :reportedOn 查询: ReadAllQuery(referenceClass=CrmDailySheet sql="SELECT * FROM CRM_DAILY_SHEET WHERE to_char(reported_on,'dd-MM-yy' ) = :reportedOn")
代码:
public List < CrmDailySheet > searchres() throws Exception {
SimpleDateFormat ddMMMyyFormat = new SimpleDateFormat("dd/MM/yy");
Date d1 = searchsht.getReportedOn();
String date_to_string = ddMMMyyFormat.format(d1);
return crmsrvc.searchDailysht(date_to_string);
}
try {
Query query = em.createNativeQuery("SELECT * FROM CRM_DAILY_SHEET
WHERE to_char (reported_on,'dd-MM-yy') = :reportedOn", CrmDailySheet.class);
query.setParameter("reportedOn", reportedOn);
List < CrmDailySheet > res = query.getResultList();
return res;
} finally {
em.close();
}
请问有人能找到解决办法吗?