You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like creating a new "entity" and supplying the id results in a failure that no key was generated.
table:
object PrinterGroupTable : IdTable<String>("printer_group") {
overrideval id = varchar("id", ID_SIZE).entityId()
val name = varchar("name", NAME_SIZE).uniqueIndex()
val loadBalancer = varchar("load_balancer", FLAG_SIZE)
}
execution:
protectedfuntransactionInsert(body:T.(InsertStatement<EntityID<K>>) ->Unit): M?= transaction {
try {
val id = table.insertAndGetId(body)
commit()
getById(id.value)
} catch (e:Exception) {
null
}
}
// Id and Name are type aliases for Stringoverridefuncreate(id:Id, name:Name, group:PrinterGroup): Printer?= transactionInsert {
it[table.id] =EntityID(id, table)
it[table.name] = name
it[table.group] = group.id
}
output when calling create:
20:17:53.249 [main] DEBUG Exposed - INSERT INTO printer_group (id, load_balancer, name) VALUES ('testGroupId0', 'testQueueManager0', 'testGroupName0')
Exception java.lang.IllegalStateException: No key generated
The text was updated successfully, but these errors were encountered:
Ideally, I'd like to remove the id parameter from my method, as it will either be passed through the body or generated with client defaults. With the current implementation, I also have to make sure that my caller does not pass an id, or there will be an exception caused by duplicate sets
Exposed 0.11.2
It seems like creating a new "entity" and supplying the id results in a failure that no key was generated.
table:
execution:
output when calling create:
The text was updated successfully, but these errors were encountered: