Invalid bound statement (not found)

mybatis报如下错误:

org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [dispatcherServlet] in context with path [/zc-beauty2] 
threw exception [Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
 com.zc.beauty.dao.ICaptchaMapper.savePhoneCode] with root cause
 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.zc.beauty.dao.ICaptchaMapper.savePhoneCode
错误之处可能有以下几个:

1、没有加载mapper文件:

<mappers>
        <mapper resource="mappers/CaptchaMapper.xml" />
</mappers>
2、接口路径写错了:

<!-- 这里namespace必须是接口的路径,不然要运行的时候要报错 “is not known to the MapperRegistry”-->
<mapper namespace="com.zc.beauty.dao.ICaptchaMapper">
3、方法名写错了:

 <!-- 这里的id必须和接口中的方法名相同,不然运行的时候也要报错 -->
    <insert id="savePhoneCode" parameterType="com.zc.beauty.model.PhoneCaptcha">
        insert into phone_captcha(u_phone, c_phonecode, c_sendtime) values(#{u_phone}, #{c_phonecode}, #{c_sendtime})
    </insert>
4、没有  <!-- 数据映射器类  mapper bean -->

 <bean id="CaptchaMapper" class="org.mybatis.spring.mapper.MapperFactoryBean" >
        <property name="sqlSessionFactory" ref="SqlSessionFactory" />
        <property name="mapperInterface" value="com.zc.beauty.dao.ICaptchaMapper" />
    </bean>
大概就以上问题。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值