Re: getting primary key values for inserted records?

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: getting primary key values for inserted records?
Дата
Msg-id Pine.LNX.4.33.0401271219200.27584-100000@leary.csoft.net
обсуждение исходный текст
Ответ на getting primary key values for inserted records?  (Guido Fiala <guido.fiala@dka-gmbh.de>)
Список pgsql-jdbc

On Tue, 27 Jan 2004, Guido Fiala wrote:

> Hallo,
>
> I'am currently at the point, that after i insert a new Record in a ResultSet
> using insertRow() and using a serial for the primary key of the target table.
>
> Of course i do not call rs.updateInt(primaryKey), as the sequence does get me
> the new value automatically.
>
> However - even using rs.refreshRow() doesn't get me the values, just a requery
> of the ResultSet.
>
> What is the way to go here?
>

Other than reissuing the query, the only real way around this is to
separately issue a nextval call on the sequence and use that value in
rs.updateInt.  There is no way for the JDBC driver to know what the
primary key turned out to be otherwise.

Kris Jurka




В списке pgsql-jdbc по дате отправления:

Предыдущее
От: Barry Lind
Дата:
Сообщение: Re: Patch to readd documentation
Следующее
От: Jeremy Buchmann
Дата:
Сообщение: Re: getting primary key values for inserted records?