Closed akatecker closed 6 years ago
Good morning :) I'm very happy that you like VoK and thanks for letting me know. I realized that I should run the test battery on all major databases, to quickly catch obvious bugs such as this one: #4
Let me look at this issue more closely.
Fixed in vok-orm 0.3. The true
parameter in createQuery()
actually makes sense to be used for all databases since it mandates sql2o
to return the generated key. So I guess PostgreSQL does the right thing and if false is passed in, it won't return the key.
0.3 released, please try to upgrade and let me know if it helped.
Good evening! While trying to implement a simple CRUD application, I ran into an exception when calling the method save() in order to create a new row of data.
org.sql2o.Sql2oException: Keys where not fetched from database. Please call executeUpdate(true) to fetch keys
Looking up the internet, it seems to be a known problem of sql2o 1.5.4 when inserting a new row into a postgresql database (sql2o issue 170). As sql2o 1.6 is still not out, others have posted workarounds (... Adjustments and Fixes). I managed to solve my problem by reimplementing the method save() in my data class adding
con.createQuery("...."
,true)
Although other RDBMS seem not to be affected, I think it would be a great help for postgresql users to include this change into VoK ORM. Thank you again for the great work on VoK Best regards,