Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found f

àì夳堔傛蜴生んèń 2024-04-18 15:59 171阅读 0赞

错误描述

  1. Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement 'com.shiyaxin.dao.IUserDao.saveUser!selectKey'. It's likely that neither a Result Type nor a Result Map was specified.

错误提示就是:

  1. 原因:org.apache.ibatis.executorExecutorException:运行了一个查询,没有找到映射语句“com.shiyaxin.dao.IUserDao.saveUser!selectKey”的结果映射。很可能既没有指定结果类型,也没有指定结果映射。

代码

  1. <!--保存用户-->
  2. <insert id="saveUser" parameterType="com.shiyaxin.Bean.User">
  3. <selectKey resultType="int" keyProperty="id" keyColumn="id" order="AFTER"><!-- 保存中的细节,保存成功后返回保存的id-->
  4. SELECT LAST_INSERT_ID();
  5. </selectKey>

原因:写这个保存成功以后返回字段 selectKey标签里少写了 resultType=“int”

发表评论

表情:
评论列表 (有 0 条评论,171人围观)

还没有评论,来说两句吧...

相关阅读