Cause: java.lang.IllegalArgumentException: argument type mismatch

原创 2012年03月26日 18:50:47

	public XiuItemAttr selectByPrimaryKey(Integer xiaId) throws SQLException {
		return (XiuItemAttr) sqlMapClient.queryForObject(
				"XIU_ITEM_ATTR.ibatorgenerated_selectByPrimaryKey", xiaId);
	}

ibatis

  <select id="ibatorgenerated_selectByPrimaryKey" parameterClass="com.pltfm.index.model.XiuItemAttr" resultMap="ibatorgenerated_BaseResultMap">
    <!--
      WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
      This element was generated on Mon Mar 26 18:36:42 CST 2012.
    -->
    select <include refid="ibatorgenerated_column_name"/>
    from XIU_ITEM_ATTR
    where XIA_ID = #xiaId:INTEGER#
  </select>
通过代码生成器生成
改成这个

  <select id="ibatorgenerated_selectByPrimaryKey" parameterClass="java.lang.Integer" resultMap="ibatorgenerated_BaseResultMap">
    <!--
      WARNING - This element is automatically generated by Apache iBATIS ibator, do not modify.
      This element was generated on Mon Mar 26 18:36:42 CST 2012.
    -->
    select <include refid="ibatorgenerated_column_name"/>
    from XIU_ITEM_ATTR
    where XIA_ID = #xiaId:INTEGER#
  </select


com.ibatis.common.beans.ProbeException: Could not set property 'xiaId' to value '3511' for com.pltfm.index.model.XiuItemAttr.  Cause: java.lang.IllegalArgumentException: argument type mismatch

    at com.ibatis.common.beans.ComplexBeanProbe.setProperty(ComplexBeanProbe.java:368)
    at com.ibatis.common.beans.ComplexBeanProbe.setObject(ComplexBeanProbe.java:234)
    at com.ibatis.common.beans.GenericProbe.setObject(GenericProbe.java:90)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.executeSelectKey(SqlMapExecutorDelegate.java:427)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:387)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.insert(SqlMapClientImpl.java:58)
    at com.pltfm.index.dao.XiuItemAttrDAOImpl.insertSelective(XiuItemAttrDAOImpl.java:78)
    at com.pltfm.index.service.XiuItemAttrService.addXiuItemAttr(XiuItemAttrService.java:34)
    at com.pltm.index.service.XiuItemAttrServiceTest.setUp(XiuItemAttrServiceTest.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.ibatis.common.beans.MethodInvoker.invoke(MethodInvoker.java:17)
    at com.ibatis.common.beans.ComplexBeanProbe.setProperty(ComplexBeanProbe.java:356)
    ... 32 more




java.lang.IllegalArgumentException: argument type mismatch

在mysql取出int类型的数据时,在java中却是Long类型的.此时实体属性类型为int就会报错,参数类型不匹配.... 同样的事情也会使用orcale数据库时出现... 修改属性类型和对应g...
  • amtea
  • amtea
  • 2011年10月11日 10:52
  • 19674

web开发时java.lang.IllegalArgumentException: argument type mismatch异常及解决方法

最近在做一个项目的时候,突然间出现了这个异常 严重:Servlet.service() for servlet action threw exception java.lang.Illegal...

java.lang.IllegalArgumentException: argument type mismatch websocket 调用 json 报错

Exceptionjavax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found 七月 23, 201...

Caused by: java.lang.IllegalArgumentException: argument type mismatch错误

2014-06-24 08:51:42,984 ERROR [main] (DefSchedulerEngine.java:157) - 调度引擎启动异常 org.springframework.o...

mybatis多表查询报java.lang.IllegalArgumentException: argument type mismatch

最近两天在搞多表查询:我觉得要注意一下几点 1:确定哪张表为主表 2:在主表中添加对象类型的属性,并且确定是一对一还是一对多 3:在mapper.xml中使用ResultMap的方式进行字段的整...

用友NC开发:保存时报错argument type mismatch

用友NC开发:保存时报错argument type mismatch       Caused by: java.lang.IllegalArgumentException: Failed to s...

【JUnit】Eclipse下junit@Test出现Type mismatch: cannot convert from Test to Annotation错误

我所使用的是junit4.10,通过add external jars
  • zhtao01
  • zhtao01
  • 2014年05月30日 20:58
  • 7146

java.lang.IllegalArgumentException: argument type mismatch

五月 30, 2012 1:11:13 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() fo...
  • snowjlz
  • snowjlz
  • 2012年05月30日 14:00
  • 3254

java反射泛型异常:argument type mismatch解决方案

最近使用java反射泛型的时候出现异常:argument type mismatch,经过debug排查终于解决,废话不说,直接上代码: javabean及相应的执行函数如下所示: pub...

Cause: java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for ^

ERROR: org.apache.ibatis.exceptions.PersistenceException:### Error querying database.  Cause:java.l...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Cause: java.lang.IllegalArgumentException: argument type mismatch
举报原因:
原因补充:

(最多只允许输入30个字)