Обсуждение: JDBC and composite types

Поиск
Список
Период
Сортировка

JDBC and composite types

От
Marcin Gala
Дата:
Could anyone tell me, how to read table's columns that are of composite
type? I was trying to use getObject with different types of casting,
however nothing worked :( Also getString doesn't give me a string
representation of type...

My type is:

CREATE TYPE forwarding_number AS
  (always number_type,
   busy number_type,
   "notResponding" number_type,
   "notLogged" number_type);

I'm trying to get data from  table X where column y is of type
forwarding_number.

Marcin

Re: JDBC and composite types

От
Kris Jurka
Дата:

On Sat, 19 May 2007, Marcin Gala wrote:

> Could anyone tell me, how to read table's columns that are of composite type?
> I was trying to use getObject with different types of casting, however
> nothing worked

Technically getObject on a complex type should return an instance of
java.sql.Struct by default or an instance of java.sql.SQLData if the type
has been mapped to a specific java class.  This has not been implemented
in the pg driver yet though.

> :( Also getString doesn't give me a string representation of type...
>

It does for me.  See the attached example.

Kris Jurka

Вложения