org.springframework.orm.hibernate3.HibernateQueryException: could not locate na

悠悠隱於市發表於2011-01-10

2011-1-10 21:29:19 javax.faces.event.MethodExpressionActionListener processAction
嚴重: org.springframework.orm.hibernate3.HibernateQueryException: could not locate named parameter [gender];

 

 nested exception is org.hibernate.QueryParameterException: could not locate named parameter [gender]
 at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:657)
 at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
 at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424)
 at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
 at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedParam(HibernateTemplate.java:947)
 at com.rs.common.core.dao.AbstractDao.getObjectsByQuery(AbstractDao.java:196)
 at com.rs.common.core.dao.UserDaoImpl.getUserByQuery(UserDaoImpl.java:66)
 at com.rs.common.core.service.UserServiceImpl.getUserListPageByCriteria(UserServiceImpl.java:206)
 at com.rs.admin.web.common.accesscontrolmaintenance.controller.AclMemberTableControllerImpl.handleSearch(AclMemberTableControllerImpl.java:114)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:592)
 at org.apache.el.parser.AstValue.invoke(AstValue.java:191)
 at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
 at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:99)
 at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
 at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:771)
 at javax.faces.component.UICommand.broadcast(UICommand.java:372)
 at com.icesoft.faces.component.panelseries.UISeries$RowEvent.broadcast(UISeries.java:617)
 at com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:285)
 at com.icesoft.faces.component.paneltabset.PanelTabSet.broadcast(PanelTabSet.java:320)
 at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
 at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
 at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
 at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:18)
 at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:132)
 at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:74)
 at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:31)
 at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
 at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
 at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
 at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:53)
 at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:26)
 at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
 at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:131)

 

 

解決方案:

 

檢查你的Hql語句,時候引數設定了. 但是Hql語句中,沒有繫結引數..

 

比如Hql語句如下:

private final static String SEARCH_EXISTS_USERLIST_BY_CRITERIA_HQL=" from User user where " +
 " (user.userId not in (:memberExistsUser)) ";

 

只有一個引數..

 

你卻在,Map集合中,多新增了一個引數.

Map<String,Object> paramMap =  new HashMap<String,Object>();

paramMap.put("memberExistsUser","1","2","3");

paramMap.put("gender","testError");

 

could not locate named parameter [gender];

..

 

此錯誤提示,不能找到 引數 gender..

相關文章