https://kotlinlang.org logo
#exposed
Title
# exposed
t

tapac

02/26/2018, 1:02 PM
In your case you should use
insertAndGetId
When you write
insert[id]
you try to get value related to "expression" from resultSet. It can be null if, for example, it wasn't inserted, that's why column type (not-nullable) doesn't make sense.
z

ziad

03/02/2018, 4:31 PM
Hi, I’m getting the same error after updating, can you share an example of using insertAndGetId?
@oshai maybe you can help? 🙂
I think I found an example in the wiki! So good to see some documentation ^^
👍 2
Okay, I think I just noticed a minor thing (perhaps intended).
Copy code
object StarWarsFilms : Table() {
  val id: Column<Int> = integer("id").autoIncrement().primaryKey()
}
this doesn’t support insertAndGetId
Copy code
object StarWarsFilms : IntIdTable() {
  
}
this does
5 Views