Can mybatis mapper have array return type?
I've query like select dept_no from employee where emp_id in (1,2) which returns two rows.
mapper.xml has following
<select id="getDeptNo" resultType="int">
SELECT dept_no FROM employee
where ticker in
<foreach item="item" index="index" collection="array" open="("
And in the mapper class , can I've
public int getDeptNo(String empId);
When I try this , it is throwing an exception java.lang.ClassCastException: [I incompatible with [Ljava.lang.Object;
I've to declare the returnType to "Integer" and have the mapper class declaration as public List<Integer> getDeptNo(String empId);
Why I can not get the array?
Remember to always leap before you look. But always take the time to smell the tiny ads:
SKIP - a book about connecting industrious people with elderly land owners