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

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: sdavidr <david(dot)ricoma(at)gmail(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Problems with Hibernate Discriminators and 9.0-801.jdbc4
Date: 2011-03-28 22:13:54
Message-ID: AANLkTik_5mWeWs7RyVwa7-3BgDdgH1QR3XSYQntY9-7e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On 29 March 2011 02:05, sdavidr <david(dot)ricoma(at)gmail(dot)com> wrote:

> Hibernate could receive a lot of numbers from a "returning *" but doesn't
> know what is the correct value. It expects to be the first element, but if
> is not, it fails.

Ok, so this is really a Hibernate bug. Hibernate needs to be fixed to
either request the correct generated column, or to choose the correct
column from the resultset. Of course, working out what the "correct
column" is could be tricky, but at least Hibernate has access to the
application's description of its data model so it's in a much better
position than the driver to do this.

> In another way, method from postgres driver getGeneratedKeys cannot return
> the full table, isn't it?

As Dave said, unless you explicitly ask for certain columns, it gives
you the entire inserted row because trying to determine a smaller set
of "generated" columns requires information that the driver doesn't
have. It's fine from a spec point of view to do this. Also, even if we
could find a smaller set of columns to return, there still might be
more than one and Hibernate would still fail ..

Oliver

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Craig Ringer 2011-03-29 00:05:03 Re: JDBC gripe list
Previous Message Kevin Grittner 2011-03-28 17:34:16 Re: idea to have driver return immediately after a query