mybatis报错does not contain value for

来源:互联网 发布:附近编程培训班 编辑:程序博客网 时间:2024/06/05 14:58
mybatis报错
严重: Servlet.service() for servlet [springDispatcherServlet] in context with path [/SocketSSM] threw exception [Request processing failed; nested exception is java.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.mapper.UserMapper.usernameGetUser] with root causejava.lang.IllegalArgumentException: Mapped Statements collection does not contain value for com.mapper.UserMapper.usernameGetUser

1.先看看
<mapper namespace="com.mapper.UserMapper">

namespace要写对

2.在看xml

 <select id="getPassword" parameterType="String" resultType="String">
id要与相关mapper中方法名一致

3.如果都没错就要看有没有引入xml了

    <!-- 扫描存放SQL语句的Category.xml -->    <bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean">        <property name="typeAliasesPackage" value="pojo" />        <property name="dataSource" ref="dataSource"/>        <property name="mapperLocations" value="classpath:com/mapper/*.xml"/>    </bean>



阅读全文
0 0