Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the MyBatis equivalent to the iBatis <isParameterPresent> tag?

I am porting some old iBatis version 2.? code and am wondering how to replace the <isParameterPresent> tag? I have read the MyBatis user guide, and know you can do a <if test=""> but I do not know how to refer to the the parameter object? Does it have a special name? Is there a different tag to use?

like image 248
Sled Avatar asked Oct 10 '22 07:10

Sled


1 Answers

It turns out that there is a special variable called "_parameter". It does not appear in the user guide, but it should be there according to Jeff Butler. You can then test this variable for null.

Thus it seems the replacement for <isParameterPresent> is <if test="_parameter != null">.

like image 90
Sled Avatar answered Oct 13 '22 02:10

Sled