问答详情
源自:4-8 DAO层单元测试编码和问题排查(上)

为何account里面没有get?account是我自己的表对应的实体类

rg.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'account' in 'class org.approval.entity.Account'

    
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'account' in 'class org.approval.entity.Account'
   



提问者:台风下雨天 2017-03-14 22:19

个回答

  • 台风下雨天
    2017-03-15 17:02:52

    解决了,应该是a_name = #{aName} and a_password = #{aPassword} and a_enable = 1

  • 台风下雨天
    2017-03-15 13:58:33

    难道是我的xml配置错了?

    <mapper namespace="org.approval.dao.AccountDao">
       <!--目的: 为DAO接口方法提供SQL-->


       <select id="queryByName" parameterType="Account" resultType="Account">
           select
             a_id,a_name,a_password,a_grade,a_enable
           from
             account
           where
             a_name = #{account.aName} and a_password = #{account.aPassword} and a_enable = 1
       </select>

    </mapper>