First, the problem found
<select id= "Querystudentbynum" resulttype= "Student" parametertype= "string" >
Select Num,name,phone from Student
<where>
<if test = "Num!=null and num!=" >
and num = #{num}
</if>
</where>
</select>
The MyBatis query passes in a string-pass parameter, and is reported to there is no getters for the property named ' Num ' in ' Class java.lang.String '.
Second, solve the problem
<select id= "Querystudentbynum" resulttype= "Student" parametertype= "string" >
<where>
_ Parameter !=null and _parameter ! = "" >
and num = #{ _parameter }
</IF>
</WHERE>
</ Select>
Regardless of the parameter name, change to "_parameter".
Third, the reason analysis
MyBatis by default with ONGL parsing parameters, so the object tree will automatically take the form of string.num values, causing error. The public List methodName (@Param (value= "num") String num can also be used to describe the parameter values
Reference blog:
Http://blog.sina.com.cn/s/blog_86e49b8f010191hw.html
http://txin0814.iteye.com/blog/1533645
MyBatis Package There is no getter for property named ' Roomname ' in ' Class java.lang.String '