'MyBatis XML access to incoming array without casting from string

In below code I get PgArray as an array of PrimaryKeys to template table, from another select query (<collection ... select='selectTemplate'/>). But the solution below seems like a little messy way of doing it. isn't there a way to access the array directly, so I wouldn't need to cast? Hint: Having #{_parameter} doesn't work.

  <select id="selectTemplate" parameterType="org.postgresql.jdbc.PgArray" resultMap="templateResultMap">
    SELECT *
    FROM template
    WHERE template.id = ANY ('${_parameter}'::int[])
  </select>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source