Joined: Wed May 03, 2006 5:09 pm Posts: 17
|
Hibernate version:
3.2.0 cr 4
Full stack trace of any exception that occurs:
javax.ejb.EJBTransactionRolledbackException: java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: named parameter [testId] not of expected type; expected = class java.lang.Integer; but was =java.lang.String 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79) 2006-10-06 12:50:25,782 ERROR [STDERR] at $Proxy158.search(Unknown Source) 2006-10-06 12:50:25,782 ERROR [STDERR] at com.qcomm.operation.search.SearchOperationHandler.handleOperation(SearchOperationHandler.java:44) 2006-10-06 12:50:25,782 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2006-10-06 12:50:25,782 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2006-10-06 12:50:25,782 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2006-10-06 12:50:25,782 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) 2006-10-06 12:50:25,782 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:201) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,798 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79) 2006-10-06 12:50:25,814 ERROR [STDERR] at $Proxy175.handleOperation(Unknown Source) 2006-10-06 12:50:25,814 ERROR [STDERR] at com.qcomm.operation.OperationDelegatorBean.performOperation(OperationDelegatorBean.java:139) 2006-10-06 12:50:25,814 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2006-10-06 12:50:25,814 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2006-10-06 12:50:25,814 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2006-10-06 12:50:25,814 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) 2006-10-06 12:50:25,814 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,829 ERROR [STDERR] at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:131) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79) 2006-10-06 12:50:25,845 ERROR [STDERR] at $Proxy178.performOperation(Unknown Source) 2006-10-06 12:50:25,845 ERROR [STDERR] at com.qcomm.servlet.OperationManager.doOperation(OperationManager.java:103) 2006-10-06 12:50:25,845 ERROR [STDERR] at com.qcomm.servlet.OperationManager.doPost(OperationManager.java:45) 2006-10-06 12:50:25,845 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 2006-10-06 12:50:25,845 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) 2006-10-06 12:50:25,845 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) 2006-10-06 12:50:25,861 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) 2006-10-06 12:50:25,861 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595) 2006-10-06 12:50:25,876 ERROR [STDERR] Caused by: java.lang.IllegalArgumentException: org.hibernate.TypeMismatchException: named parameter [userId] not of expected type; expected = class java.lang.Integer; but was =java.lang.String 2006-10-06 12:50:25,876 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:70) 2006-10-06 12:50:25,876 ERROR [STDERR] at com.qcomm.session.security.QUserManagerBean.search(QUserManagerBean.java:220) 2006-10-06 12:50:25,876 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2006-10-06 12:50:25,876 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 2006-10-06 12:50:25,876 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 2006-10-06 12:50:25,876 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) 2006-10-06 12:50:25,876 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112) 2006-10-06 12:50:25,876 ERROR [STDERR] at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166) 2006-10-06 12:50:25,876 ERROR [STDERR] at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63) 2006-10-06 12:50:25,876 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,876 ERROR [STDERR] at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126) 2006-10-06 12:50:25,892 ERROR [STDERR] ... 98 more 2006-10-06 12:50:25,892 ERROR [STDERR] Caused by: org.hibernate.TypeMismatchException: named parameter [userId] not of expected type; expected = class java.lang.Integer; but was =java.lang.String 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.hql.QueryLoader.bindNamedParameters(QueryLoader.java:520) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1576) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.Loader.doQuery(Loader.java:661) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.Loader.doList(Loader.java:2144) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.Loader.list(Loader.java:2023) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) 2006-10-06 12:50:25,892 ERROR [STDERR] at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64) 2006-10-06 12:50:25,892 ERROR [STDERR] ... 112 more
Name and version of the database you are using:
Oracle 10g r2
The generated SQL (show_sql=true):
2006-10-06 12:50:25,767 DEBUG [org.hibernate.SQL]
select
quser0_.qUserId as qUserId73_,
quser0_.businessId as businessId73_,
quser0_.username as username73_,
quser0_.firstName as firstName73_,
quser0_.lastName as lastName73_,
quser0_.internal as internal73_,
quser0_.userAccountStatusId as userAcc15_73_,
quser0_.forcePasswordChange as forcePas7_73_,
quser0_.emailAddress as emailAdd8_73_,
quser0_.passwordChangeDate as password9_73_,
quser0_.accountExpirationDate as account10_73_,
quser0_.failedLoginAttempts as failedL11_73_,
quser0_.impersonatable as imperso12_73_,
quser0_.statusChangeDate as statusC13_73_,
quser0_.template as template73_
from
QUser quser0_
where
quser0_.qUserId like ?
Debug level Hibernate log excerpt:
Hi,
I'm having a problem where I'm trying to do a query like this:
Code: SELECT * FROM TestTable WHERE testId like '1%' My EJBQL/HQL looks like this: Code: SELECT tt FROM TestTable tt WHERE tt.testId LIKE :testId If I try to set the parameter :testId to "1%" I get a TypeMismatchException telling me that I can't set the parameter to be a String, that it has to be an Integer. Is there somehow to tell hibernate to ignore doing any type checking on the value or some other way I could do this sort of query? There are a number of situations where I would like to be able to do a like query on a non-string field. BTW, I can execute the following query just fine if I don't use a parameter for the '1%': Code: SELECT tt FROM TestTable tt WHERE tt.testId LIKE '1%' Entity Definition:Code: @Entity @NamedQuery(name="test",query="SELECT tt FROM TestTable tt WHERE tt.testId LIKE :testId") public class TestTable implements Serializable {
@Id private int testId;
public int getTestId() { return testId; } public void setTestId(int id) { this.testId = id; }
}
|
|