"create type" custom types not supported by JDBC

From: Roy Smith <roy(dot)smith(at)primetext(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: "create type" custom types not supported by JDBC
Date: 2007-12-01 07:52:36
Message-ID: 475112C4.9060403@primetext.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2007-12-01 08:29:52 Re: AbstractJdbc2Array - another patch
Previous Message Christian Kindler 2007-11-30 17:43:05 Re: prepared statement using postgres array