Also, is there any form of update that returns the...
# komapper
d
Also, is there any form of update that returns the record updated (and what if it wasn't updated for some reason)?
t
Update query returns a new record that may have a new version number and a new timestamp:
Copy code
val updatedAddress = db.runQuery { QueryDsl.update(a).single(newAddress) }
However, the record does not include updates on the database side.
To get a new record from database, you have to issue a new select query.
d
Oh.. and with the
set { }
version, I'd suppose that even more so... (that's the one I'm using...). the
single()
version only updates what changed, or all the fields?
t
The
set {}
version does not return new records. The
single()
version updates all the fields.
d
I wonder if the dbs like postgres that support returning things in the same update could somehow be supported, while for those that don't it could be a new request...