db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance J. Andersen" <Lance.Ander...@Sun.COM>
Subject Re: behavior of Statement.getGeneratedKeys()
Date Tue, 11 Jul 2006 00:56:18 GMT


>
> These seem reasonable. On the other hand, using getGeneratedKeys() to
> determine the type & name of a table's generated key seems very very
> unlikely to me. It would require that the application/tool can insert a
> row of the correct shape, if the app/tool can do that, then it probably
> already knows the columns's definition. Also some auto-discovering tool
> seems unlikely to use getGeneratedKeys as it would require perturbing
> the database by having a successful INSERT (though maybe a INSERT INTO
> T(a,b,c) SELECT a,b,c FROM T WHERE 1=0 might work). Seems way too
> contrived though to say getGeneratedKeys() is a useful tool for
> gathering metadata.
>
> Dan.
>   
You are correct, a tool would use DatabaseMetaData and expect the column 
type returned from getGeneratedKeys()  to match the column defined in 
the table for the auto-generated key  in the case the identity column.

Mime
View raw message