MyBatis Tips[SQL mapper framework for Java]


MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings in Java.

I would like to introduce some tips about MyBatis.

🐰 About multiple arguments in DAO

When defining the interface in Dao file and having multiple arguments, you should use @Param xxx.

public List<com.test.myTest> getAllbyDate(@Param("date") Date date, @Param("myid") int myid);

If there are multiple arguments and you do not use @ Param, the error is as follows:

org.apache.ibatis.binding.BindingException: Parameter 'myid' not found. Available parameters are [1, 0, param1, param2]

Please be careful.

😎 Special Thanks

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!