From: | Bendik Rognlien Johansen <bensmailinglists(at)gmail(dot)com> |
---|---|
To: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Retrieving arrays |
Date: | 2006-10-10 13:15:23 |
Message-ID: | 533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
Hello,
I wrote this method to read arrays from my result set.
public class MyClass {
public <T> T[] getArray(ResultSet rs, String column) throws
Exception {
if(rs.getArray(column) != null) {
return (T[]) rs.getArray(column).getArray();
}
return null;
}
}
I call i like this:
String[] values = MyClass.<String>getArray(rs, "myStringArrayColumn"));
This works fine. ( "myStringArrayColumn" is of type character
varying(64)[])
But, when I call:
Integer[] values = MyClass.<Integer>getArray(rs,
"myIntegerArrayColumn"));
( "myIntegerArrayColumn" is of type integer[])
I get a:
java.lang.ClassCastException: [I
Any ideas?
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2006-10-10 14:02:52 | Re: Postgres XA support |
Previous Message | Per Jensen | 2006-10-10 12:05:02 | Re: Test of 8.2beta1 fails |