Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id CFF909FB32F for ; Wed, 11 Oct 2006 08:54:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 91304-04 for ; Wed, 11 Oct 2006 11:54:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.174]) by postgresql.org (Postfix) with ESMTP id C424C9FB349 for ; Wed, 11 Oct 2006 08:54:14 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id 30so79714ugc for ; Wed, 11 Oct 2006 04:54:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-mailer; b=q2rGpifEaqmsDRyh0yhDUCDyKAJowwJjANnJvRVIEM8P7yv4uBp5uHQycX05UlGo43aNfxGZFTu0XyGQypXcQ6FKG1cktOFdjsJv/EoAeZCxCMIvvCEjl1itHRSRKHmpnaX8Nl+qJGSLNVHcwio/RrsJSz3FkvXNkUj0ohZy+ek= Received: by 10.67.93.6 with SMTP id v6mr878127ugl; Wed, 11 Oct 2006 04:54:12 -0700 (PDT) Received: from ?10.80.1.43? ( [85.221.54.254]) by mx.google.com with ESMTP id m1sm707557uge.2006.10.11.04.54.12; Wed, 11 Oct 2006 04:54:12 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <1160503178.8082.10.camel@archimedes> References: <533747B3-BC3C-4D07-A2B8-A3C86B85C718@gmail.com> <1160503178.8082.10.camel@archimedes> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Bendik Rognlien Johansen Subject: Re: Retrieving arrays Date: Wed, 11 Oct 2006 13:54:10 +0200 To: pgsql-jdbc@postgresql.org X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200610/65 X-Sequence-Number: 15948 Ok, thanks! So, that probably means I can not do this sort of thing with Generics? Is there any way the driver could get the same behavior as the driver used in PL/Java? In PL/Java i can do: return (String[]) rs.getObject(column); On Oct 10, 2006, at 7:59 PM, Mark Lewis wrote: > 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 > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq