Reputation: 161
There is my code. Can someone tell me what is wrong?
for(String motorProposalId : proposalMap.keySet()) {
MotorPolicy mp = policyMap.get(motorProposalId);
String query = "SELECT p From Payment Where p.referenceNo = :motorProposalId"+
" AND commenmanceDate >= :startDate AND commenmanceDate <= :endDate";
Query qu = em.createQuery(query);
qu.setParameter("commenmanceDate", mp.getCommenmanceDate());
qu.setParameter("motorProposalId", motorProposalId);
qu.setParameter("startDate", motorDailyCriteria.getStartDate());
qu.setParameter("endDate", motorDailyCriteria.getEndDate());
Upvotes: 0
Views: 73
Reputation: 42104
Query is syntactically incorrect because there is no named parameter commenmanceDate
in query string. If commenmanceDate
should be named parameter, then it must be prefixed with ':'.
Also then query likely have some semantic problems, because all values included to date comparisons are already known before executing query.
Upvotes: 2