Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 393A72E0033 for ; Mon, 18 Feb 2008 10:02:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 47694-03 for ; Mon, 18 Feb 2008 10:02:34 -0400 (AST) Received: from mailout1.pacific.net.au (mailout1-3.pacific.net.au [61.8.2.210]) by postgresql.org (Postfix) with ESMTP id 4161A2E002D for ; Mon, 18 Feb 2008 10:02:33 -0400 (AST) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.2.163]) by mailout1.pacific.net.au (Postfix) with ESMTP id CCD11352DF9; Tue, 19 Feb 2008 01:02:27 +1100 (EST) Received: from [192.168.1.3] (ppp3645.dsl.pacific.net.au [203.143.215.69]) by mailproxy2.pacific.net.au (Postfix) with ESMTP id 7B3E12740C; Tue, 19 Feb 2008 01:02:27 +1100 (EST) Message-ID: <47B98FEC.80502@pacific.net.au> Date: Tue, 19 Feb 2008 01:02:20 +1100 From: Andrew User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: Kris Jurka CC: ntr , pgsql-jdbc@postgresql.org Subject: Re: UUID datatype References: <47B6E776.9030608@pacific.net.au> <6e6cc3bc0802160806o6e686b15jbea6cc3e7b36ccbd@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/119 X-Sequence-Number: 18326 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