pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roy Smith <roy.smith@primetext.com>
To: pgsql-jdbc@postgresql.org
Subject: "create type" custom types not supported by JDBC
Date: Sat, 01 Dec 2007 07:52:36 +0000
Message-ID: <475112C4.9060403@primetext.com> (raw)

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


If I add a mapping with ...
map.put("couk_cleverthinking_gwappo_currency",Class.forName("Money") )
connection.setTypeMap(map)

Then I get ...
java.lang.ClassCastException: java.lang.Class cannot be cast to 
java.sql.SQLData
    at 
org.postgresql.jdbc2.AbstractJdbc2Connection.getObject(AbstractJdbc2Connection.java:403)



Poking around the source code of AbstractJdbc2Connection it looks like 
this functionality isn't support.

Please could somebody confirm this is the cause and offer any insights 
as to when it might be included.

Perhaps an "Unsupported feature" error would be more helpful than a 
ClassCastException.

Very best wishes
Roy






view thread (4+ messages)  latest in thread

Message-ID: <475112C4.9060403@primetext.com>
Permalink:  ../475112C4.9060403@primetext.com/
Also on:    postgresql.org/message-id/475112C4.9060403@primetext.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: roy.smith@primetext.com
  Subject: Re: "create type" custom types not supported by JDBC
  In-Reply-To: <475112C4.9060403@primetext.com>
  References: <475112C4.9060403@primetext.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox