java - findByNamedQueryAndNamedParam classcastexception -
i using hibernate 3, , method below work 1 time, second time when called method obtain error message :
16:51:45,371 info [org.hibernate.type.integertype] (http-localhost-127.0.0.1-8081-2) not bind value '812' parameter: 2; java.lang.string cannot cast java.lang.integer 16:51:45,442 error [org.apache.catalina.core.containerbase.[jboss.web].[default-host].[/sg].[faces servlet]] (http-localhost-127.0.0.1-8081-2) "servlet.service()" pour la servlet faces servlet généré une exception: java.lang.classcastexception: java.lang.string cannot cast java.lang.integer
i have verified debug mode , code integer, don't understrand why error message speaking string.
thanks.
public bureaumodification getdernieremodification(integer code) { list listbureau = gethibernatetemplate().findbynamedqueryandnamedparam("bureau.detail.last", "codebureau", code); if (!listbureau.isempty()) { return (bureaumodification) listbureau.get(0); } return null; } <query name="bureau.detail.last" comment="détail d'un bureau à partir du code bureau"> <![cdata[from bureaumodification (code, datemiseajour) in (select code, max(datemiseajour) bureaumodification code = :codebureau group code)]]> </query>
full stacktrace :
17:21:11,467 info [org.hibernate.type.integertype] (http-localhost-127.0.0.1-8081-6) not bind value '812' parameter: 2; java.lang.string cannot cast java.lang.integer 17:21:11,507 warning [javax.enterprise.resource.webcontainer.jsf.lifecycle] (http-localhost-127.0.0.1-8081-6) #{fusioncreationbean.create}: java.lang.classcastexception: java.lang.string cannot cast java.lang.integer: javax.faces.facesexception: #{fusioncreationbean.create}: java.lang.classcastexception: java.lang.string cannot cast java.lang.integer @ com.sun.faces.application.actionlistenerimpl.processaction(actionlistenerimpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] @ javax.faces.component.uicommand.broadcast(uicommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ javax.faces.component.uiviewroot.broadcastevents(uiviewroot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ javax.faces.component.uiviewroot.processapplication(uiviewroot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ com.sun.faces.lifecycle.invokeapplicationphase.execute(invokeapplicationphase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:] @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:] @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] @ javax.faces.webapp.facesservlet.service(facesservlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:329) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:248) [jbossweb-7.0.13.final.jar:] @ org.apache.myfaces.webapp.filter.extensionsfilter.dofilter(extensionsfilter.java:357) [tomahawk20-1.1.13.jar:1.1.13] @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:280) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:248) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:275) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:161) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:489) [jbossweb-7.0.13.final.jar:] @ org.jboss.as.web.security.securitycontextassociationvalve.invoke(securitycontextassociationvalve.java:153) [jboss-as-web-7.1.1.final.jar:7.1.1.final] @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:155) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:368) [jbossweb-7.0.13.final.jar:] @ org.apache.coyote.http11.http11processor.process(http11processor.java:877) [jbossweb-7.0.13.final.jar:] @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:671) [jbossweb-7.0.13.final.jar:] @ org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:930) [jbossweb-7.0.13.final.jar:] @ java.lang.thread.run(unknown source) [rt.jar:1.7.0_21] caused by: javax.faces.el.evaluationexception: java.lang.classcastexception: java.lang.string cannot cast java.lang.integer @ javax.faces.component.methodbindingmethodexpressionadapter.invoke(methodbindingmethodexpressionadapter.java:102) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ com.sun.faces.application.actionlistenerimpl.processaction(actionlistenerimpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:] ... 24 more caused by: java.lang.classcastexception: java.lang.string cannot cast java.lang.integer @ org.hibernate.type.integertype.set(integertype.java:41) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.type.nullabletype.nullsafeset(nullabletype.java:136) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.type.nullabletype.nullsafeset(nullabletype.java:107) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.persister.collection.abstractcollectionpersister.writeelement(abstractcollectionpersister.java:755) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.persister.collection.abstractcollectionpersister.recreate(abstractcollectionpersister.java:1143) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.action.collectionrecreateaction.execute(collectionrecreateaction.java:26) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.engine.actionqueue.execute(actionqueue.java:250) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.engine.actionqueue.executeactions(actionqueue.java:234) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.engine.actionqueue.executeactions(actionqueue.java:145) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.event.def.abstractflushingeventlistener.performexecutions(abstractflushingeventlistener.java:298) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.event.def.defaultautoflusheventlistener.onautoflush(defaultautoflusheventlistener.java:41) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.impl.sessionimpl.autoflushifrequired(sessionimpl.java:969) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.impl.sessionimpl.list(sessionimpl.java:1114) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.impl.queryimpl.list(queryimpl.java:79) [hibernate3.jar:3.2.4.sp1] @ org.springframework.orm.hibernate3.hibernatetemplate$33.doinhibernate(hibernatetemplate.java:938) [spring-2.0.3.jar:2.0.3] @ org.springframework.orm.hibernate3.hibernatetemplate.execute(hibernatetemplate.java:367) [spring-2.0.3.jar:2.0.3] @ org.springframework.orm.hibernate3.hibernatetemplate.findbynamedqueryandnamedparam(hibernatetemplate.java:929) [spring-2.0.3.jar:2.0.3] @ org.springframework.orm.hibernate3.hibernatetemplate.findbynamedqueryandnamedparam(hibernatetemplate.java:919) [spring-2.0.3.jar:2.0.3] @ fr.perso.pri.core.dao.impl.caisseregionalemodificationdaoimpl.getdernieremodification(caisseregionalemodificationdaoimpl.java:77) [classes:] @ fr.perso.pri.core.service.impl.fusionserviceimpl.loadlistecr2(fusionserviceimpl.java:288) [classes:] @ fr.perso.pri.core.service.impl.fusionserviceimpl.create(fusionserviceimpl.java:166) [classes:] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [rt.jar:1.7.0_21] @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ java.lang.reflect.method.invoke(unknown source) [rt.jar:1.7.0_21] @ org.springframework.aop.support.aoputils.invokejoinpointusingreflection(aoputils.java:299) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.reflectivemethodinvocation.invokejoinpoint(reflectivemethodinvocation.java:172) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:139) [spring-2.0.3.jar:2.0.3] @ org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:107) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:161) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:202) [spring-2.0.3.jar:2.0.3] @ com.sun.proxy.$proxy21.create(unknown source) @ fr.perso.pri.web.beans.fusioncreationbean.create(fusioncreationbean.java:116) [classes:] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [rt.jar:1.7.0_21] @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ java.lang.reflect.method.invoke(unknown source) [rt.jar:1.7.0_21] @ org.apache.el.parser.astvalue.invoke(astvalue.java:262) [jbossweb-7.0.13.final.jar:] @ org.apache.el.methodexpressionimpl.invoke(methodexpressionimpl.java:278) [jbossweb-7.0.13.final.jar:] @ com.sun.faces.facelets.el.tagmethodexpression.invoke(tagmethodexpression.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:] @ javax.faces.component.methodbindingmethodexpressionadapter.invoke(methodbindingmethodexpressionadapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] ... 25 more 17:21:11,592 error [org.apache.catalina.core.containerbase.[jboss.web].[default-host].[/sg].[faces servlet]] (http-localhost-127.0.0.1-8081-6) "servlet.service()" pour la servlet faces servlet généré une exception: java.lang.classcastexception: java.lang.string cannot cast java.lang.integer @ org.hibernate.type.integertype.set(integertype.java:41) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.type.nullabletype.nullsafeset(nullabletype.java:136) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.type.nullabletype.nullsafeset(nullabletype.java:107) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.persister.collection.abstractcollectionpersister.writeelement(abstractcollectionpersister.java:755) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.persister.collection.abstractcollectionpersister.recreate(abstractcollectionpersister.java:1143) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.action.collectionrecreateaction.execute(collectionrecreateaction.java:26) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.engine.actionqueue.execute(actionqueue.java:250) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.engine.actionqueue.executeactions(actionqueue.java:234) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.engine.actionqueue.executeactions(actionqueue.java:145) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.event.def.abstractflushingeventlistener.performexecutions(abstractflushingeventlistener.java:298) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.event.def.defaultautoflusheventlistener.onautoflush(defaultautoflusheventlistener.java:41) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.impl.sessionimpl.autoflushifrequired(sessionimpl.java:969) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.impl.sessionimpl.list(sessionimpl.java:1114) [hibernate3.jar:3.2.4.sp1] @ org.hibernate.impl.queryimpl.list(queryimpl.java:79) [hibernate3.jar:3.2.4.sp1] @ org.springframework.orm.hibernate3.hibernatetemplate$33.doinhibernate(hibernatetemplate.java:938) [spring-2.0.3.jar:2.0.3] @ org.springframework.orm.hibernate3.hibernatetemplate.execute(hibernatetemplate.java:367) [spring-2.0.3.jar:2.0.3] @ org.springframework.orm.hibernate3.hibernatetemplate.findbynamedqueryandnamedparam(hibernatetemplate.java:929) [spring-2.0.3.jar:2.0.3] @ org.springframework.orm.hibernate3.hibernatetemplate.findbynamedqueryandnamedparam(hibernatetemplate.java:919) [spring-2.0.3.jar:2.0.3] @ fr.perso.pri.core.dao.impl.caisseregionalemodificationdaoimpl.getdernieremodification(caisseregionalemodificationdaoimpl.java:77) [classes:] @ fr.perso.pri.core.service.impl.fusionserviceimpl.loadlistecr2(fusionserviceimpl.java:288) [classes:] @ fr.perso.pri.core.service.impl.fusionserviceimpl.create(fusionserviceimpl.java:166) [classes:] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [rt.jar:1.7.0_21] @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ java.lang.reflect.method.invoke(unknown source) [rt.jar:1.7.0_21] @ org.springframework.aop.support.aoputils.invokejoinpointusingreflection(aoputils.java:299) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.reflectivemethodinvocation.invokejoinpoint(reflectivemethodinvocation.java:172) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:139) [spring-2.0.3.jar:2.0.3] @ org.springframework.transaction.interceptor.transactioninterceptor.invoke(transactioninterceptor.java:107) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.reflectivemethodinvocation.proceed(reflectivemethodinvocation.java:161) [spring-2.0.3.jar:2.0.3] @ org.springframework.aop.framework.jdkdynamicaopproxy.invoke(jdkdynamicaopproxy.java:202) [spring-2.0.3.jar:2.0.3] @ com.sun.proxy.$proxy21.create(unknown source) @ fr.perso.pri.web.beans.fusioncreationbean.create(fusioncreationbean.java:116) [classes:] @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) [rt.jar:1.7.0_21] @ sun.reflect.nativemethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ sun.reflect.delegatingmethodaccessorimpl.invoke(unknown source) [rt.jar:1.7.0_21] @ java.lang.reflect.method.invoke(unknown source) [rt.jar:1.7.0_21] @ org.apache.el.parser.astvalue.invoke(astvalue.java:262) [jbossweb-7.0.13.final.jar:] @ org.apache.el.methodexpressionimpl.invoke(methodexpressionimpl.java:278) [jbossweb-7.0.13.final.jar:] @ com.sun.faces.facelets.el.tagmethodexpression.invoke(tagmethodexpression.java:105) [jsf-impl-2.1.7-jbossorg-2.jar:] @ javax.faces.component.methodbindingmethodexpressionadapter.invoke(methodbindingmethodexpressionadapter.java:88) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ com.sun.faces.application.actionlistenerimpl.processaction(actionlistenerimpl.java:102) [jsf-impl-2.1.7-jbossorg-2.jar:] @ javax.faces.component.uicommand.broadcast(uicommand.java:315) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ javax.faces.component.uiviewroot.broadcastevents(uiviewroot.java:794) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ javax.faces.component.uiviewroot.processapplication(uiviewroot.java:1259) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ com.sun.faces.lifecycle.invokeapplicationphase.execute(invokeapplicationphase.java:81) [jsf-impl-2.1.7-jbossorg-2.jar:] @ com.sun.faces.lifecycle.phase.dophase(phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:] @ com.sun.faces.lifecycle.lifecycleimpl.execute(lifecycleimpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:] @ javax.faces.webapp.facesservlet.service(facesservlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.final.jar:2.0.1.final] @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:329) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:248) [jbossweb-7.0.13.final.jar:] @ org.apache.myfaces.webapp.filter.extensionsfilter.dofilter(extensionsfilter.java:357) [tomahawk20-1.1.13.jar:1.1.13] @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:280) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:248) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:275) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:161) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:489) [jbossweb-7.0.13.final.jar:] @ org.jboss.as.web.security.securitycontextassociationvalve.invoke(securitycontextassociationvalve.java:153) [jboss-as-web-7.1.1.final.jar:7.1.1.final] @ org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:155) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:102) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:109) [jbossweb-7.0.13.final.jar:] @ org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:368) [jbossweb-7.0.13.final.jar:] @ org.apache.coyote.http11.http11processor.process(http11processor.java:877) [jbossweb-7.0.13.final.jar:] @ org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:671) [jbossweb-7.0.13.final.jar:] @ org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:930) [jbossweb-7.0.13.final.jar:] @ java.lang.thread.run(unknown source) [rt.jar:1.7.0_21]
Comments
Post a Comment