updateable resultset only working for tables?
От | Guido Fiala |
---|---|
Тема | updateable resultset only working for tables? |
Дата | |
Msg-id | 200403111336.55740.guido.fiala@dka-gmbh.de обсуждение исходный текст |
Ответы |
Re: updateable resultset only working for tables?
|
Список | pgsql-jdbc |
First i tried to update/insert records using an updateable resultset using a table as datasource, that works just fine. My application requires to do updates also to views which are created about as this: create view sometable_update as Select * from sometable; create rule sometable_update_rule as on update to sometable_update do instead update sometable set ...; Updating to sometable_update does work if i type an update statement myself. However, using code like this: Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet urs=stmt.executeQuery("SELECT * FROM sometable_update"); results in an SQLException "no primary keys". Basically i assume, that this happens because the driver is not able to detect the primary keys of a view, which is mainly because postgres stores views in a completly different way as tables. Is there a way to tell the driver the primary keys manually (as i know them at this point in my code) for a certain ResultSet/Statement or another solution to this problem? If possible i would like to avoid creating my own insert/update-Strings and let it do the driver. Guido
В списке pgsql-jdbc по дате отправления: