Use JDBI to get Postgres Array Data

2019-05-26 10:59发布

I have a java program using JDBI (a JDBC wrapper) to access a PostgreSQL database. One of the columns is of the array data type (mycolumn integer[]).

What the heck to I use in my mapper class? I thought resultSet.getArray("mycolumn") would be the right thing to do, but I'm not sure how to get the data out of the java.sql.Array object that gets returned.

Any hints or good links on how to do this?

标签: java jdbc jdbi
1条回答
甜甜的少女心
2楼-- · 2019-05-26 12:01
        Array array = resultSet.getArray("mycolumn");
        return nonNull(array) ? (Integer[])array.getArray() : null ;
查看更多
登录 后发表回答