https://kotlinlang.org logo
Title
d

Dennis Schröder

04/05/2019, 8:20 AM
Hey guys. I am looking for some best practices / tuts ,/ etc. for Ktor in combination with Kotlin exposed especially about using transactions in coroutines! Would appreciate any suggestions.
d

Dennis Schröder

04/05/2019, 10:11 AM
Yeah I already stumbled across this one! My problem is that when I use
withContext() { transaction{}}
I get an
no transaction context found error
when working with the DAO and many to many relations.
r

Robert Jaros

04/05/2019, 10:22 AM
Unfortunately I haven't used Exposed with this types of relations. Only very simple foreign keys.
d

Dico

04/05/2019, 7:41 PM
Exposed does not support coroutines. The reasoning is that it wraps jdbc which is a blocking api. It intends to add coroutine support though. For the time being, your best bet is not to change thread in the context of a transaction.
👍🏼 2