Search code examples
sqldatabaseormibatis

create table in ibatis with array data type


I'm trying to use ibatis with HSSQL to create a table in an in memory database at runtime but using the following returns an error, presumably because the square brackets confuse Ibatis, which results in a SQLException: Incorrect syntax near 'ARRAY'

CREATE TABLE GROUPS (id INT PRIMARY KEY, members bigint ARRAY DEFAULT ARRAY[])

I tried escaping in XML like this but got the same error:

<![CDATA[ CREATE TABLE MATCHGROUPS (id INT PRIMARY KEY, groupid bigint ARRAY DEFAULT ARRAY[], members bigint ARRAY DEFAULT ARRAY[]) ]]>

Anyone know a way to work around this? I'd like to keep the design consistent and not resort to a raw query for this case if possible. I've checked that the sql runs fine in HSSQL manager so it's the right sql syntax.

Thanks in advance


Solution

  • The CDATA excape actually does work, I discovered a mistake I made somewhere else that was causing the misleading error!