How to use Annotations with iBatis (myBatis) for an IN query?

I believe the answer is the same as is given in this question. You can use myBatis Dynamic SQL in your annotations by doing the following: @Select({“<script>”, “SELECT *”, “FROM blog”, “WHERE id IN”, “<foreach item=’item’ index=’index’ collection=’list'”, “open='(‘ separator=”,” close=”)”>”, “#{item}”, “</foreach>”, “</script>”}) List<Blog> selectBlogs(@Param(“list”) int[] ids); The <script> element enables dynamic SQL parsing … Read more