Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4

From: Dave Cramer <pg(at)fastcrypt(dot)com>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: sdavidr <david(dot)ricoma(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4
Date: 2011-03-28 09:54:15
Message-ID: AANLkTimHhNpk1Nx9kEza7DyffzTLH=P6ja4XM9j0-yCS@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Mon, Mar 28, 2011 at 5:43 AM, Oliver Jowett <oliver(at)opencloud(dot)com> wrote:
> On 28 March 2011 21:02, sdavidr <david(dot)ricoma(at)gmail(dot)com> wrote:
>
>> The question is: is it very difficult to change that to a more correct
>> returning [identifier] ?
>
> BTW, the driver *does* do exactly this if you call the query execution
> methods that take an array of column names to return as generated
> keys.
> You only get RETURNING * added to the query if you asked for
> RETURN_GENERATED_KEYS without specifying any column names.
> So it sounds like Hibernate is doing something wrong, but it's very
> hard to tell without seeing a concrete testcase.
>

Ok, looking at the hibernate source this is what is in the PostgreSQLDialect

public String getIdentitySelectString(String table, String column, int type) {
return new StringBuffer().append("select currval('")
.append(table)
.append('_')
.append(column)
.append("_seq')")
.toString();
}

which will work assuming you are using sequences for identities. There
are some other issues in the dialect, but for the most part it is
sane.

So we will need to see exactly what you are doing that does not work.

Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Chris Wareham 2011-03-28 10:13:57 Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4
Previous Message Oliver Jowett 2011-03-28 09:43:10 Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4