From: Andrew <archa@pacific.net.au>
To: Kris Jurka <books@ejurka.com>
Cc: ntr <kfeezh@gmail.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: UUID datatype
Date: Tue, 19 Feb 2008 01:02:20 +1100
Message-ID: <47B98FEC.80502@pacific.net.au> (raw)
In-Reply-To: <Pine.BSO.4.64.0802161113490.495@leary.csoft.net>
References: <47B6E776.9030608@pacific.net.au>
<Pine.BSO.4.64.0802161048420.25216@leary.csoft.net>
<6e6cc3bc0802160806o6e686b15jbea6cc3e7b36ccbd@mail.gmail.com>
<Pine.BSO.4.64.0802161113490.495@leary.csoft.net>
Hi All,
This is probably noise to most people by now, so apologies if it is.
I have done some digging around this area, and the following are my
findings:
Using the JDBC 4 Driver via plain java.sql.* libraries, there is no
problem at all with the UUID datatype. I tested with both
java.sql.Statement and java.sql.PreparedStatement objects and String
UUID representations.
I also created a PGuuid object within the PG JDBC Driver to see what it
entailed, and that worked fine as well. However, in my mind, it is
totally superfluous. I can provide the source code if anyone sees value
in it, but I'm of the opinion that there really isn't any work to do in
the driver to support the datatype. Particularly while the UUID
datatype is missing from java.sql.Types, as any solution would be tied
to accessing this datatype via the Driver API rather than the java.sql.*
API, unless anyone can enlighten me on a solution.
The main reason I raised this in the first place was that I wasn't able
to get this to work in Hibernate. So with Hibernate, and various forums
I'd read, I had assumed that the UUID datatype wasn't working at all
through the Driver. However, as I have just described, I was incorrect
with this assumption.
To get Hibernate to work I needed to create a custom Hibernate type.
Additionally, the default Hibernate uuid.hex generator by Gavin King is
not correctly formatted, including when using the separator attribute,
so the DB rejects this format, which is understandable. So I also
created a custom uuid generator that uses Java's random uuid creator.
If there is interest and anyone is struggling with this, I can provide
further details. I see these issues as specific to Hibernate rather
than a problem with the JDBC Driver.
Now that I have worked through the solution, I have no issues if this
request is withdrawn from the wish list. Just cranky with myself that
it has taken two whole days to figure out the solution, three if I
include the initial question and waiting on the response...
Thanks, and you're doing a brilliant job,
Andy
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: archa@pacific.net.au, books@ejurka.com, kfeezh@gmail.com
Subject: Re: UUID datatype
In-Reply-To: <47B98FEC.80502@pacific.net.au>
References: <47B6E776.9030608@pacific.net.au> <Pine.BSO.4.64.0802161048420.25216@leary.csoft.net> <6e6cc3bc0802160806o6e686b15jbea6cc3e7b36ccbd@mail.gmail.com> <Pine.BSO.4.64.0802161113490.495@leary.csoft.net> <47B98FEC.80502@pacific.net.au>
* 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