title: How to send a List in select query of IBatis?
body: <p>I am using <code>Java 1.7, IBatis and postgreSQL</code></p>
  
  <p>I have a <code>StudentVO</code></p>
  
  <pre><code>import java.util.List;
      public class StudentVO {
  
          private Long studentId;
          private String studentName;
          private List&lt;Long&gt; studentFriendNums;
  
          //getters and setters
      }
  </code></pre>
  
  <p>My <code>Function</code> in postgreSQL is <code>get_party_details(VARIADIC bigint[])</code></p>
  
  <pre><code>CREATE OR REPLACE FUNCTION get_party_details(VARIADIC bigint[])
    RETURNS TABLE(studentid bigint,studentName character varying, amtPaid numeric) AS
  $BODY$
       DECLARE
          SQL VARCHAR;
  BEGIN
      RETURN QUERY
          SELECT
               STU.student_id   as "Student ID"
              ,STU.student_name as "Student Name"
              ,STU.amt_paid     as "Amount Paid"
  
          FROM    STUDENT     STU
  
              WHERE STU.STUDENT_ID IN ( SELECT $1[I] FROM GENERATE_SUBSCRIPTS($1, 1) G(I));
  END;
  
  $BODY$
    LANGUAGE plpgsql VOLATILE
    COST 100
    ROWS 1000;
  </code></pre>
  
  <p>My Function Returns the following Results:</p>
  
  <blockquote>
    <p>select * from get_party_details(101,102,103,104);</p>
  </blockquote>
  
  <pre><code>StudentId  Student Name     Amt Paid
  101          JOHN           428000.00
  102          SMITH          275405.00
  103          JACKSON        109250.00
  104          LOVELESS       63200.00
  </code></pre>
  
  <p>My <code>queries.xml</code></p>
  
  <pre><code>&lt;select id="get_party_details" parameterType="StudentVO" 
          statementType="PREPARED" resultMap="partyMap"&gt;
              select * from get_party_details(#{studentFriendNums})
  &lt;/select&gt;
  
      &lt;resultMap type="StudentVO" id="partyMap"&gt;
          &lt;result property="studentId"            column="studentid" /&gt;
          &lt;result property="studentName"          column="studentname" /&gt;
          &lt;result property="amtPaid"              column="amtpaid" /&gt;
      &lt;/resultMap&gt;
  </code></pre>
  
  <p>If i use the above Select Statement i am getting the below Exception:</p>
  
  <pre><code>org.apache.ibatis.exceptions.PersistenceException: 
  ### Error querying database.  Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property 'studentFriendNums'.  It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
  ### Cause: java.lang.IllegalStateException: Type handler was null on parameter mapping for property 'studentFriendNums'.  It was either not specified and/or could not be found for the javaType / jdbcType combination specified.
  </code></pre>
  
  <p>Any help/suggestions ?</p>
  
  <p><strong>Edit 1:</strong> I Tried a foreach loop as well which didn't get me out of the issue.</p>
  
  <pre><code>&lt;select id="get_party_details" parameterType="StudentVO" statementType="PREPARED" resultMap="partyMap"&gt;
          select * from get_party_details(
          &lt;foreach item="friends" index="index" collection="studentFriendNums"
              open="(" separator="," close=")"&gt;
              #{friends}
          &lt;/foreach&gt;
          )
      &lt;/select&gt;
  </code></pre>
  
  <p>Exception with <code>&lt;foreach/&gt;</code>:</p>
  
  <pre><code>org.apache.ibatis.exceptions.PersistenceException: 
  ### Error querying database.  Cause: org.postgresql.util.PSQLException: ERROR: function get_party_details(record) does not exist
    Hint: No function matches the given name and argument types. You might need to add explicit type casts.
    Position: 15
  ### The error may exist in com/myblog/queries.xml
  ### The error may involve com.myblog.StudentDAO.get_party_details-Inline
  ### The error occurred while setting parameters
  ### SQL: select * from epc.get_party_details(    (      ?    ,     ?    ,     ?    ,     ?    )    )
  ### Cause: org.postgresql.util.PSQLException: ERROR: function get_party_details(record) does not exist
    Hint: No function matches the given name and argument types. You might need to add explicit type casts.
    Position: 15
  </code></pre>
  
  <p><strong>Edit 2:</strong> My Ibatis version is <code>3.2.3</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE mapper
    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
      "http://mybatis.org/dtd/mybatis-3-mapper.dtd"&gt;
      &lt;mapper namespace="com.myblog.StudentDTO"&gt;
  
      &lt;select id="get_party_details" parameterType="StudentVO" 
        statementType="PREPARED" resultMap="partyMap"&gt;
          select * from get_party_details
       &lt;iterate property="studentFriendNums" conjunction="," open = "(" close = ")"&gt;
              #studentFriendNums[]#
       &lt;/iterate&gt;
  &lt;/select&gt;
  
      &lt;resultMap type="StudentVO" id="partyMap"&gt;
          &lt;result property="studentId"            column="studentid" /&gt;
          &lt;result property="studentName"          column="studentname" /&gt;
          &lt;result property="amtPaid"              column="amtpaid" /&gt;
      &lt;/resultMap&gt;
  
  &lt;/mapper&gt;
  </code></pre>