MyBatis Version: Mybatis-3.0.6.jar
1. When the entry parameter is of type string (including java.lang.String.)
We use #{xxx} to introduce parameters. Throws an exception there is no getter for property named ' xxx ' in ' Class java.lang.String '
<select id= "Getbookingcount" resulttype= "int" parametertype= "string" >select count (*) from Tb_empc_booking_ ORDER twhere (t.state = ' 1 ' or t.state = ' 2 ') and t.appointmenttime = #{state}</select>
2. Workaround one: Modify #{xxx} to #{_parameter}
<select id= "Getbookingcount" resulttype= "int" parametertype= "string" >select count (*) from Tb_empc_booking_ ORDER twhere (t.state = ' 1 ' or t.state = ' 2 ') and T.appointmenttime = #{_parameter}</select>
3. Workaround two: You can define it in advance in the method:
public int MethodName (@Param (value= ' state ') String state) {...}
4. Reason: MyBatis by default with ONGL parsing parameters, so will automatically take the form of the object tree string.xxx value, if not defined in the method, will throw an exception error.
5. Other MyBatis version do not know whether there is this problem, not yet tried.
MyBatis exception There is no getter for property named ' XXX ' in ' Class java.lang.String '