Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 3AB0C9FB2F4 for ; Tue, 10 Oct 2006 15:00:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 53583-08 for ; Tue, 10 Oct 2006 15:00:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mir3-fs.mir3.com (mail.mir3.com [65.208.188.100]) by postgresql.org (Postfix) with ESMTP id 5D8D39FB2EF for ; Tue, 10 Oct 2006 15:00:36 -0300 (ADT) Received: mir3-fs.mir3.com 172.16.1.11 from 172.16.2.68 172.16.2.68 via HTTP with MS-WebStorage 6.0.6249 Received: from archimedes.mirlogic.com by mir3-fs.mir3.com; 10 Oct 2006 10:59:38 -0700 Subject: Re: Retrieving arrays From: Mark Lewis To: Bendik Rognlien Johansen Cc: pgsql-jdbc@postgresql.org In-Reply-To: <533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com> References: <533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: MIR3, Inc. Date: Tue, 10 Oct 2006 10:59:38 -0700 Message-Id: <1160503178.8082.10.camel@archimedes> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-27.rhel4.6) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.164 tagged_above=0 required=5 tests=AWL, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200610/64 X-Sequence-Number: 15947 Java 5 doesn't support auto-boxing an int[] as an Integer[]. -- Mark Lewis On Tue, 2006-10-10 at 15:15 +0200, Bendik Rognlien Johansen wrote: > Hello, > I wrote this method to read arrays from my result set. > > > public class MyClass { > public 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.getArray(rs, "myStringArrayColumn")); > > This works fine. ( "myStringArrayColumn" is of type character > varying(64)[]) > > > But, when I call: > > Integer[] values = MyClass.getArray(rs, > "myIntegerArrayColumn")); > ( "myIntegerArrayColumn" is of type integer[]) > > > I get a: > java.lang.ClassCastException: [I > > > Any ideas? > > Thanks > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org