org.hibernate.QueryException: Not all named parameters have been set: [testv] [select ps.id.hsxmCode,ps.id.spwjCode,ps.mc,ps.lx,ps.parentCode,ps.sfdc,ps.jhStart,ps.jhEnd,ps.sjStart,ps.sjEnd,ps.shdw,ps.shzt,ps.wcbl,ps.flagWc from PubSpwj as ps where 1=1 and ps.id.hsxmCode=:hsxmCode and ps.shzt=:testv order by ps.id.spwjCode]
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:115)
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:102)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:70)
at com.hs.busimanage.buildprocess.business.EditBProcessBO.queryProcessList(EditBProcessBO.java:78)
at com.hs.busimanage.buildprocess.struts.action.BProcessListAction.queryBProcessList(BProcessListAction.java:85)
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:585)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.hs.util.common.HSCharsetFilter.doFilter(HSCharsetFilter.java:24)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
解决办法:在BO里赋查询条件语句:
if(testv!=null&&!testv.equals("")) query.setParameter("testv",testv);
ls=query.list();