Skip site navigation (1) Skip section navigation (2)

Re: Support of getting generated keys in driver version 8.4devel

From: Kris Jurka <books(at)ejurka(dot)com>
To: Miłosz Tylenda <mtylenda(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Support of getting generated keys in driver version 8.4devel
Date: 2009-01-15 04:29:04
Message-ID: Pine.BSO.4.64.0901142323100.32378@leary.csoft.net (view raw or flat)
Thread:
Lists: pgsql-jdbc

On Mon, 5 Jan 2009, Miosz Tylenda wrote:

>> I intentionally left supportsGetGeneratedKeys false because we don't
>> support returning generated keys by column indexes. Without knowing how
>> used that method is, I'm not sure if this is more or less helpful. I'm
>> open to input if people think we should change it to true.
>
> Kris, my picture is that I work with Apache OpenJPA - an object-
> relational mapper. OpenJPA checks whether generated keys are supported
> by calling DatabaseMetaData.supportsGetGeneratedKeys(). If true, the
> generated keys are retrieved from PreparedStatement by giving column
> names. If false, a second query is executed to get the value of
> sequence associated with serial column. So, in the OpenJPA context,
> supportsGetGeneratedKeys returning true would be more helpful, but I
> can also imagine a case where it would break things.
>

Please try this updated driver which supports generated keys for prepared 
statements as well.  I've also flipped supportsGetGeneratedKeys to true as 
I believe that will be more helpful to more users.

http://ejurka.com/pgsql/jars/genkey/

Kris Jurka

In response to

Responses

pgsql-jdbc by date

Next:From: Vlastimil HavranekDate: 2009-01-15 13:14:26
Subject: Problem with committing in XA mode
Previous:From: Oliver JowettDate: 2009-01-12 05:44:04
Subject: Re: COPY command works with older driver but not newer one ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group