问题
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?
回答1:
Array array = resultSet.getArray("mycolumn");
return nonNull(array) ? (Integer[])array.getArray() : null ;
来源:https://stackoverflow.com/questions/16093398/use-jdbi-to-get-postgres-array-data