You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by galo <an...@gmail.com> on 2007/08/21 16:09:53 UTC

postgresql: java array -> jdbc array

Hi, I'm trying to create a parameter map to insert/update a boolean array
into a table.

This is my statement, and column2 is a boolean[]

<insert id="insertBlah" parameterMap="paramMap">
  INSERT INTO mytable (column1, column2)
  VALUES (#column1#, #column2#)
</insert>

I've tried  INSERT INTO mytable (column1, column2)  VALUES (#column1#,
'{t,f,f,f,t,f,t,f,f,f}')
with a dummy array as a string, and it works, so I thought I could just pass
a string

<parameterMap id="paramMap" class="java.util.Map">
  <parameter property="column1" javaType=" java.lang.Boolean"  />
  <parameter property="column2" javaType="java.lang.String"  />
</parameterMap>

I get: ERROR: column "column2" is of type boolean[] but expression is of
type character varying

I've tried an endless list of combinations, passing either Strings, Boolean
arrays, etc. and none work.

I'm trying to write my own Type handler, but i get into a similar problem,
whatever i insert in the setter ibatis complains it's not a boolean[]

How am i supposed to do this? (I can't find any reference to arrays in the
documentation..)

Cheers,