Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 8A4D12E0071 for ; Sat, 1 Dec 2007 04:39:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 50994-03 for ; Sat, 1 Dec 2007 04:39:03 -0400 (AST) Received: from mail63.csoft.net (leary.csoft.net [205.205.214.5]) by postgresql.org (Postfix) with SMTP id 0667D2E0073 for ; Sat, 1 Dec 2007 04:39:03 -0400 (AST) Received: (qmail 17477 invoked by uid 1112); 1 Dec 2007 08:39:03 -0000 Date: Sat, 1 Dec 2007 03:39:03 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Roy Smith cc: pgsql-jdbc@postgresql.org Subject: Re: "create type" custom types not supported by JDBC In-Reply-To: <475112C4.9060403@primetext.com> Message-ID: References: <475112C4.9060403@primetext.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/3 X-Sequence-Number: 17858 On Sat, 1 Dec 2007, Roy Smith wrote: > I'm getting errors when I'm trying to access my custom data types through > JDBC. > > If I don't supply a custom map using Connection.setTypeMap() then I'm > getting ... > > org.postgresql.util.PGobject cannot be cast to Money at ... > Money m = (Money) resultSet.getObject(1); // Money is my class to handle > multi-currency money types It's not clear whether your type extends PGobject or implements SQLData. Currently the PG driver only supports custom types via its own non-standard method. You must extend PGobject and register it with the driver's non-standard type map via either PGConnection.addDataType() or via a URL paramater. > Poking around the source code of AbstractJdbc2Connection it looks like > this functionality isn't support. Perhaps an "Unsupported feature" error > would be more helpful than a ClassCastException. > Yes, it would. I'll take a look. Kris Jurka