public inbox for [email protected]  
help / color / mirror / Atom feed
Subject: [Pljava-dev] uuid datatypes and prepared statements
Date: Wed, 24 Jun 2009 11:44:17 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

It's not clear what's going on here.  Your initial claim was that the 
native Java type was String rather than UUID, but your second message 
states that the native type was UUID.

I don't think it will work for doing things like making getObject() on a 
uuid value return a UUID type.

pljava also can't do this for you automatically because UUID is new to 
the 1.5 JDK while pljava still supports JDK 1.4.  For the regular client 
JDBC driver, this functionality is only available in the JDBC4 jar for 
this reason.

Kris Jurka

Lucas Madar wrote:
> I found a workaround, but I'm not sure if there are any bad side effects 
> to doing it this way: (other than it being ugly)
> 
> Before I do any queries with Java UUIDs, I do:
>         Oid.registerType(UUID.class, new Oid(2950));
> (2950 is the 'magic number' OID from postgresql's types.h)
> 
> This seems to have the effect of letting JDBC map Java native UUIDs to 
> Postgresql UUIDs.
> 
> - Lucas
> 
> On 6/23/2009 8:00 PM, Lucas Madar wrote:
>> I'm running into a weird error when using prepared statements within 
>> pl/java:
>>
>> ERROR:  operator does not exist: uuid = text
>>
>> This is from a very basic query of "SELECT xxx FROM table WHERE 
>> uuid=?". The table's column type is uuid and the java native type is 
>> String. It works fine via plain JDBC and also works via pl/java if I 
>> use a ::uuid after the query. However, this makes maintaining these 
>> queries a mess. I'm running postgres 8.3.7.
>>
>> Has anyone else experienced this?
>>
> _______________________________________________
> Pljava-dev mailing list
> Pljava-dev at pgfoundry.org
> http://pgfoundry.org/mailman/listinfo/pljava-dev





view thread (4+ messages)  latest in thread

reply

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Subject: Re: [Pljava-dev] uuid datatypes and prepared statements
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox