关闭

Cause: java.lang.IllegalArgumentException: argument type mismatch

标签: ibatisincludejunitapacheinteger
1515人阅读 评论(0) 收藏 举报
分类:

	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




0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:72542次
    • 积分:1133
    • 等级:
    • 排名:千里之外
    • 原创:44篇
    • 转载:0篇
    • 译文:0篇
    • 评论:12条
    最新评论