I have a table in an in-memory HSQLDB database for integration test, with an ARRAY column (categories VARCHAR(256) ARRAY NOT NULL
), notice it's defined as VARCHAR array.
Is there a way to tweak the way HSQLDB maps columns to Java types? I can't for find it, for the life of me.
When the array column is read (with org.hsqldb.jdbc.JDBCDriver), resultSet.getArray(columnName).getArray()
returns an Object[]
, and not a String[]
.
This results in cast exception, since the calling code (that I'm not controlling) expects a String[]
. resultSet.getArray(columnName)
returns org.hsqldb.jdbc.JDBCArray, and ideally I would like it to return PostgreSQLTextArray so I can end up with a String[]
(that's what's used in prod).
- HSQLDB: "org.hsqldb:hsqldb:2.4.0"
- Java: 1.8.131
getArray()[0].getClass().getName()
. – Springlet