1. Code
1.1 Mapper XML
[HTML] view plain copy <select id= "GetItems" parametertype= "string" resultmap= "Itemresult" >...</sel ect> [HTML] view plain copy 1.2 Mapper interface
[Java] view plain copy public interface Orderdao {public list<item> getItems (String orderids); }
2. Issue
[plain] view plain copy There is no getter for property named ' OrderIDs ' ' Class java.lang.String '
3. Solution1
[Java] view plain copy import Org.apache.ibatis.annotations.Param; Public interface Orderdao {public list<item> getItems (@Param ("OrderIDs") String orderids); } 4.solution2
First, the problem
<select id= "Querystudentbynum" resulttype= "Student" parametertype= "string" >
select Num,name, Phone from student
<where>
<if test = "Num!=null and num!=" "> and
num = #{num}
</if>< c6/></where>
</select>
mybatis Query Pass in a string pass parameter, report there is no getter for property named ' Num ' class Java.lang.String '.
ii. Problem Solving
<select id= "Querystudentbynum" resulttype= "Student" parametertype= "string" >
Select num , Name,phone from student
<where>
<if test = "_parameter!=null and_parameter!=" "> and
num = #{_parameter}
</if>
</where>
</select>
Regardless of parameter name, change to "_parameter".
Iii. Analysis of
causes MyBatis defaults to the use of Ongl parsing parameters, so will automatically take the form of object tree String.num value, resulting in an error. You can also specify the method of the public List methodname (@Param (value= "num") String num for parameter values
Reference blog:
http://blog.sina.com.cn/s/blog_ 86e49b8f010191hw.html
http://txin0814.iteye.com/blog/1533645
Reference:
[1] http://stackoverflow.com/questions/19848861/mybatis-dynamic-sql-using-longs