解决问题:cannot be cast to java.lang.Integer。
后台写好后,出现以下错误。(对象不能cast成int)
Hibernate: select top 22 hndcaplove0_.ID as ID249_, hndcaplove0_.idcard as idcard249_, hndcaplove0_.jwh as jwh249_, hndcaplove0_.name as name249_, hndcaplove0_.born as born249_, hndcaplove0_.guardidcard as guardidc6_249_, hndcaplove0_.guardname as guardname249_, hndcaplove0_.guardtel as guardtel249_, hndcaplove0_.creatdate as creatdate249_, hndcaplove0_.creatreason as creatre10_249_, hndcaplove0_.creattype as creattype249_, hndcaplove0_.isquit as isquit249_, hndcaplove0_.quitdate as quitdate249_, hndcaplove0_.quitreason as quitreason249_ from syrk.dbo.HndcapLovecard hndcaplove0_, syrk.dbo.PersonBaseInfo personbase1_ where hndcaplove0_.idcard=personbase1_.IDCard and personbase1_.PersonalState=’否’ and 1=1
Hibernate: select hndcaplove0_.ID as ID249_, hndcaplove0_.idcard as idcard249_, hndcaplove0_.jwh as jwh249_, hndcaplove0_.name as name249_, hndcaplove0_.born as born249_, hndcaplove0_.guardidcard as guardidc6_249_, hndcaplove0_.guardname as guardname249_, hndcaplove0_.guardtel as guardtel249_, hndcaplove0_.creatdate as creatdate249_, hndcaplove0_.creatreason as creatre10_249_, hndcaplove0_.creattype as creattype249_, hndcaplove0_.isquit as isquit249_, hndcaplove0_.quitdate as quitdate249_, hndcaplove0_.quitreason as quitreason249_ from syrk.dbo.HndcapLovecard hndcaplove0_, syrk.dbo.PersonBaseInfo personbase1_ where hndcaplove0_.idcard=personbase1_.IDCard and personbase1_.PersonalState=’否’ and 1=1
12:35:48,826 WARN RequestProcessor:516 – Unhandled Exception thrown: class java.lang.ClassCastException
2010-11-7 12:35:48 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet action threw exception
java.lang.ClassCastException: com.minZheng.model.HndcapLovecard cannot be cast to java.lang.Integer
at com.minZheng.dao.daoImpl.DisabledUnitedDaoImpl.countLoveCardList(DisabledUnitedDaoImpl.java:776)
at com.minZheng.agent.agentImpl.DisabledUnitedAgentImpl.countLoveCardList(DisabledUnitedAgentImpl.java:344)
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:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy71.countLoveCardList(Unknown Source)
at com.minZheng.action.DisabledUnitedAction.LoveCardList(DisabledUnitedAction.java:1221)
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:597)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:110)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
at com.common.MyActionServlet.process(MyActionServlet.java:14)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.orm.hibernate3.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:198)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.filter.Powerfilter.doFilter(Powerfilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Thread.java:619)
问题所在:daoimpl文件下
public int countLoveCardList(String JuWeiHui,String IDCard,String name,String StartTime,String EndTime){
StringBuffer hql = new StringBuffer(“select h from HndcapLovecard h ,PersonBaseInfo p where h.idcard=p.IDCard and p.personalState=’否’ and”);
… …
h改为count(h)