错误描述
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.
错误提示就是:
原因:org.apache.ibatis.executor。ExecutorException:运行了一个查询,没有找到映射语句“com.shiyaxin.dao.IUserDao.saveUser!selectKey”的结果映射。很可能既没有指定结果类型,也没有指定结果映射。
代码
<!--保存用户-->
<insert id="saveUser" parameterType="com.shiyaxin.Bean.User">
<selectKey resultType="int" keyProperty="id" keyColumn="id" order="AFTER"><!-- 保存中的细节,保存成功后返回保存的id-->
SELECT LAST_INSERT_ID();
</selectKey>
原因:写这个保存成功以后返回字段 selectKey标签里少写了 resultType=“int”