title: java.lang.IllegalArgumentException: Unknown parameter name : customer
body: <p>I'm trying to use the <code>getNamedQuery</code> method to create a List, but I'm getting this exception.</p>
  
  <p>Here is my code</p>
  
  <pre><code>public List&lt;Equip&gt; getEquipsByCustomer(int customer) {
  
      return (List&lt;Equip&gt;) sessionFactory.getCurrentSession()
              .getNamedQuery("getEquipsByCustomer")
              .setParameter("customer", customer)
              .list();
  }
  </code></pre>
  
  <p>And the query in the xml file</p>
  
  <pre><code>&lt;sql-query name="getEquipsByCustomer"&gt;
      &lt;return class="Equip" alias="equip"/&gt;
      &lt;query-param name="customer" type="int"/&gt;
      SELECT e.* FROM request r
      INNER JOIN equip e ON r.equip_id = e.equip_id
      INNER JOIN customer c ON r.customer_id = c.customer_id
      WHERE c.customer_id = :customer;
  &lt;/sql-query&gt;
  </code></pre>
  
  <p>I'm using another <code>getNamedQuery</code> methods but only this is getting the exception and I can't find what I'm doing wrong. Is there anything I'm missing?</p>
  
  <p>the full exception</p>
  
  <pre><code>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Unknown parameter name : customer
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:980)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
  org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
  org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:106)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
  org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  
  java.lang.IllegalArgumentException: Unknown parameter name : customer
  org.hibernate.query.internal.QueryParameterBindingsImpl.getBinding(QueryParameterBindingsImpl.java:193)
  org.hibernate.query.internal.AbstractProducedQuery.setParameter(AbstractProducedQuery.java:474)
  org.hibernate.query.internal.NativeQueryImpl.setParameter(NativeQueryImpl.java:571)
  org.hibernate.query.internal.NativeQueryImpl.setParameter(NativeQueryImpl.java:51)
  com.cclip.core.equip.EquipRepositoryImpl.getEquipsByCustomer(EquipRepositoryImpl.java:18)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  java.lang.reflect.Method.invoke(Unknown Source)
  org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302)
  org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
  org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
  org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
  org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
  org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
  org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
  com.sun.proxy.$Proxy44.getEquipsByCustomer(Unknown Source)
  com.cclip.core.equip.EquipServiceImpl.findEquipsByCustomer(EquipServiceImpl.java:37)
  com.cclip.mvc.controllers.HomeController.helloWorld(HomeController.java:67)
  sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  java.lang.reflect.Method.invoke(Unknown Source)
  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:110)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:817)
  org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:731)
  org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
  org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
  org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
  org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
  org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
  org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
  org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
  org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
  org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:106)
  org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
  org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
  org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
  org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  </code></pre>