Sled
Sled

Reputation: 18939

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?

Upvotes: 5

Views: 1740

Answers (1)

Sled
Sled

Reputation: 18939

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">.

Upvotes: 4

Related Questions