"create type" custom types not supported by JDBC - Mailing list pgsql-jdbc

From Roy Smith
Subject "create type" custom types not supported by JDBC
Date
Msg-id 475112C4.9060403@primetext.com
Whole thread Raw
Responses Re: "create type" custom types not supported by JDBC  (Kris Jurka <books@ejurka.com>)
List 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




pgsql-jdbc by date:

Previous
From: "Christian Kindler"
Date:
Subject: Re: prepared statement using postgres array
Next
From: Kris Jurka
Date:
Subject: Re: AbstractJdbc2Array - another patch