Mybatis-There is no getter for property named 'tj' in 'class java.lang.String'

来源:互联网 发布:js设置div的宽度 编辑:程序博客网 时间:2024/05/02 19:50

Xml代码  收藏代码
  1. <select id="findNoteByID" parameterType="string" resultType="note">  
  2.         SELECT * FROM TABLE   
  3.         <where>         
  4.                       
  5.             <choose>  
  6.                 <when test="id != null and id !='' ">id = #{id}</when>  
  7.                 <otherwise>1=2</otherwise>  
  8.             </choose>  
  9.         </where>  
  10. </select>  

 在测试时报错:There is no getter for property named 'id' in 'class java.lang.String'

 问题分析:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.id值,引起报错。

 解决方法:  public Note findNoteByID(@Param(value="id") String id);说明参数值。


0 0
原创粉丝点击