Ibatis3 encountered a problem today, sql inside if a variable of type String in the right to write to judge the conditions are as follows:
<if test="userYNFlag =='Y'">
AND use_yn = 'Y'
</ if>
Is always wrong, throws NumberFormatException exception, started to make me feel that only the digital types of variables to determine the conditions, but after the trial of several cases and found that the reason is Ibatis3 when parsing this expression, the ' Y 'parse into a char, rather than String, but his error and inaccurate, suggesting that any number or something like that. So confused puzzled.

Using the following method can be:
<if test='userYNFlag == "Y"'>
AND use_yn = 'Y'
</ if>

To solve this problem later, I again thought of int, because int as an int type variable and as the Integer type, not the same as the value of initialization, Integer is null, int is 0, the test was found for the following judgments:
<if test="roleId != null>
AND rmp.id = emp.id
</ if>
In the java inside roleId if int, not integer, this time, it spread to ibatis inside, it will initialized to 0, rather than null, this time to determine the above no sense, because he always is not null.