1. 程式人生 > >A query was run and no Result Maps were found for the Mapped Statement

A query was run and no Result Maps were found for the Mapped Statement

a query was run and no result maps were found for the mapped statement

Cause: org.apache.ibatis.executor.ExecutorException: A query was run and no Result Maps were found for the Mapped Statement ‘com.shadow.foretaste.UserInfoDao.getPhoneNum‘. It‘s likely that neither a Result Type nor a Result Map was specified.

導致這個錯誤的原因是:

mapper.xml中沒有指定返回值類型

<select id="getPhoneNum" >
        select phone_num from user_info where id = #{id}
</select>

修改後:

<select id="getPhoneNum" resultType="String">
        select phone_num  from user_info where id = #{id}
</select>


本文出自 “數據挖掘工程師的成長歷程” 博客,請務必保留此出處http://qianqiansun.blog.51cto.com/13271301/1965502

A query was run and no Result Maps were found for the Mapped Statement