0

Problem with the following code when bind variable is NULL:

<bind name="recipientName" value="'%'+recipientName+'%'"/>

How to handle Like operator in MyBatis when a bind variable is null?

yu yang Jian
  • 6,680
  • 7
  • 55
  • 80
akreddy.21
  • 626
  • 3
  • 8
  • 21

1 Answers1

0
    <if test = "recipientName != null">
       <bind name="recipientName" value="'%'+recipientName+'%'"/>
    </if> resolved the issue. 
akreddy.21
  • 626
  • 3
  • 8
  • 21
  • 4
    While this code snippet may solve the question, [including an explanation](//meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion. Please also try not to crowd your code with explanatory comments, this reduces the readability of both the code and the explanations! – kayess Nov 22 '16 at 10:40