title: Hibernate HQL could not locate named parameter [parameterName]
body: <p>I made a web aplication that using parameters that search some database record using spring-hibernate like this : </p>
  
  <p><a href="https://i.stack.imgur.com/j7Uxe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j7Uxe.png" alt="enter image description here"></a></p>
  
  <p>but when I press the button, I face this error <code>org.hibernate.QueryParameterException: could not locate named parameter [nama_depan]</code></p>
  
  <p>this is my class,</p>
  
  <pre><code>package org.ppbni.splatter.model;
  
  import java.io.Serializable;
  import java.util.Date;
  import javax.persistence.Column;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import javax.persistence.Entity;
  import javax.persistence.PrimaryKeyJoinColumn;
  import javax.persistence.Table;
  import javax.persistence.Temporal;
  import javax.persistence.TemporalType;
  import javax.persistence.OneToOne;
  import javax.persistence.CascadeType;
  
  @SuppressWarnings("serial")
  @Entity
  @Table(name="user")
  public class UserAdmin implements Serializable{
  
  @Id
  @GeneratedValue
  @Column(name="no_dana", unique=true, nullable=false)
  private String no_dana;
  
  @Column(name="npp")
  private String npp;
  
  @Column(name="password")
  private String password;
  
  @Column(name="nama_depan")
  private String nama_depan;
  
  @Column(name="nama_tengah")
  private String nama_tengah;
  
  @Column(name="nama_belakang")
  private String nama_belakang;
  
  @Column(name="kota")
  private String kota;
  
  @OneToOne(mappedBy="useradmin", cascade=CascadeType.ALL)
  private Wafat wafat;
  
  @OneToOne(mappedBy="useradmin", cascade=CascadeType.ALL)
  private Korwil korwil;
  
  /**other field**//
  
  /**setter and gettter methods**/
  }
  </code></pre>
  
  <p>this my DAOImpl : </p>
  
  <pre><code>@SuppressWarnings("unchecked")
  @Override
  public List&lt;UserAdmin&gt; listAllUserAdminDafAnggota(String nama, String kota)throws Exception{
      Query query = getSession().createQuery("from UserAdmin where (nama_depan = :namadepan or nama_tengah = :namatengah or nama_belakang = :namabelakang) or kota = :kota");
      query.setParameter("nama_depan", nama);
      query.setParameter("nama_tengah", nama);
      query.setParameter("nama_belakang", nama);
      query.setParameter("kota", kota);
  
      List&lt;UserAdmin&gt; result = query.list();
  
      return result;
  }
  </code></pre>
  
  <p>this is my controller,</p>
  
  <pre><code>@RequestMapping(value="/user/daftar-anggota-ppbni.html")
  public ModelAndView userDaftarAnggotaPPBNI(ModelMap model, @RequestParam(value="nama") String nama, @RequestParam(value="kota") String kota)throws Exception{
  
      List&lt;UserAdmin&gt; useradmin = userService.listAllUserAdminDafAnggota(nama, kota);
      model.addAttribute("useradmin", useradmin);
      return userDaftarAnggota(model);
  
  }
  </code></pre>
  
  <p>this is the error,</p>
  
  <pre><code>org.hibernate.QueryParameterException: could not locate named parameter [nama_depan]
  at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:101)
  at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:107)
  at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:460)
  at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:430)
  at org.ppbni.splatter.dao.impl.UserDaoImpl.listAllUserAdminDafAnggota(UserDaoImpl.java:98)
  at org.ppbni.splatter.service.impl.UserServiceImpl.listAllUserAdminDafAnggota(UserServiceImpl.java:69)
  at org.ppbni.splatter.web.controller.UserController.userDaftarAnggotaPPBNI(UserController.java:100)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  at java.lang.reflect.Method.invoke(Unknown Source)
  at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)
  at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
  at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
  at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
  at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
  at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
  at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
  at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
  at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
  at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
  at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
  at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>