Re: [JDBC] SQLData user-defined-types and getObject()

From: Kris Jurka <books(at)ejurka(dot)com>
To: Assad Jarrahian <jarraa(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: [JDBC] SQLData user-defined-types and getObject()
Date: 2006-01-08 08:17:19
Message-ID: Pine.BSO.4.61.0601080311300.11669@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-jdbc

On Sat, 7 Jan 2006, Assad Jarrahian wrote:

> I am quite confused (PLEASE PLEASE Help), I cannot find anything on
> the web). I read that you can declare a class that implements SQLData
> (in this case I set up a class called Complex from the /src/tutorial
> datatype that mimics the user-defined datatype in the db) and then set
> the mapping appropriately (see below).

This is possible according to the JDBC spec, but the postgresql driver
does not implement it. At the moment your only option is to have your
class implement org.postgresql.util.PGobject and register it using a pg
specific method. This is fine for a true user defined type, but it
certainly isn't ideal for a composite type because it requires the type
creator to handle all of the fields himself.

There isn't much documentation on PGobject implementations either, but the
javadoc and source code will point you in the right direction.

http://jdbc.postgresql.org/documentation/publicapi/org/postgresql/util/PGobject.html

Kris Jurka

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Philipp 2006-01-08 08:54:15 Re: Arrays and Performance
Previous Message pairat 2006-01-08 07:29:09 Re: The connection is dead

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jacques Gollion 2006-01-09 12:01:15 Re: BUG #2139: Problem when calling functions without any
Previous Message Assad Jarrahian 2006-01-08 03:28:28 SQLData user-defined-types and getObject()