Java.lang.IllegalArgumentException:Parameter with this position [1] did not exist
Org.hibernate.jpa.spi.BaseQueryImpl.findParameterRegistration (basequeryimpl.java:502)
Org.hibernate.jpa.spi.BaseQueryImpl.setParameter (basequeryimpl.java:692)
Org.hibernate.jpa.spi.AbstractQueryImpl.setParameter (abstractqueryimpl.java:181)
Org.hibernate.jpa.spi.AbstractQueryImpl.setParameter (ABSTRACTQUERYIMPL.JAVA:32) Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method) Sun.reflect.NativeMethodAccessorImpl.invoke ( nativemethodaccessorimpl.java:62) Sun.reflect.DelegatingMethodAccessorImpl.invoke (
delegatingmethodaccessorimpl.java:43) Java.lang.reflect.Method.invoke (method.java:497) Org.springframework.orm.jpa.sharedentitymanagercreator$deferredqueryinvocationhandler.invoke ( sharedentitymanagercreator.java:372) com.sun.proxy. $Proxy 55.setParameter (Unknown Source) com.*. Report.dao.logistics.impl.LogiEvaluationDao.logisticsEvaluationDownload (logievaluationdao.java:27) com.*. Report.web.controllEr.sales.SalesReportController.logisticsEvaluationDownload (salesreportcontroller.java:61) Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method) Sun.reflect.NativeMethodAccessorImpl.invoke ( nativemethodaccessorimpl.java:62) Sun.reflect.DelegatingMethodAccessorImpl.invoke (
delegatingmethodaccessorimpl.java:43) Java.lang.reflect.Method.invoke (method.java:497)
Org.springframework.web.method.support.InvocableHandlerMethod.doInvoke (invocablehandlermethod.java:221) Org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest (invocablehandlermethod.java:136 ) Org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle (
servletinvocablehandlermethod.java:114) Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod (
requestmappinghandleradapter.java:827) Org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal ( Requestmappinghandleradapter.java:738) Org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle ( abstracthandlermethodadapter.java:85) Org.springframework.web.servlet.DispatcherServlet.doDispatch ( dispatcherservlet.java:963) Org.springframework.web.servlet.DispatcherServlet.doService (Dispatcherservlet.java
: 897) Org.springframework.web.servlet.FrameworkServlet.processRequest (frameworkservlet.java:970)
Org.springframework.web.servlet.FrameworkServlet.doPost (frameworkservlet.java:872)
Javax.servlet.http.HttpServlet.service (httpservlet.java:648)
Org.springframework.web.servlet.FrameworkServlet.service (frameworkservlet.java:846)
Javax.servlet.http.HttpServlet.service (httpservlet.java:729)
Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (characterencodingfilter.java:197)
Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107) Org.apache.tomcat.websocket.server.WsFilter.doFilter (wsfilter.java:52)
This is caused by the addition of double quotes when the date type is passed in.
WHERE a.dispatch_date>= '? 1 ' And a.dispatch_date<= '? 2 '
After modification
WHERE A.dispatch_date>=?1 and A.dispatch_date<=?2
Javax.persistence.query Setparameter
Query query = Getem (). Createnativequery (Sql.tostring ());
Query.setparameter (1, Calendarutils.getformatdate (calendarutils). Y_m_d_long, Dispatchdatestart));