is there a preferred ORM in Kotlin that offers asy...
# getting-started
b
is there a preferred ORM in Kotlin that offers async? in Java there's basically Hibernate and Jooq and I don't see anything immediately obviously preferred in Kotlin (ideally database first)
1
c
I'm not aware of any. From what I see in the ecosystem, most people prefer writing requests themselves (using something like #exposed or #kmongo, which both support
suspend
).
b
thank you
c
Both have object mapping, though, so depending on what you want they may be enough for your needs
b
the difficult parts that I want to avoid are basically M2M mapping and n+1 issues
c
Both libraries can do mapping. I'm not sure how an ORM helps with n+1, but I'm mostly using MongoDB, which is quite different from SQL, so maybe I'm not affected.
b
hibernate for instance gives you JOIN FETCH to avoid that
c
Since you seem mostly interested in the SQL side, I recommend asking a question about exactly the features you want in #exposed
b
ah, you're right, thank you
👍 1
s
two jobs ago we did use jooq in our kotlin app, don't remember is it was async though 🤔 https://www.jooq.org/doc/latest/manual/getting-started/jooq-and-kotlin/
k
JOOQ has coroutine support, basically an adapter for their Java-based reactive streams API. It supports async I/O when used with an R2DBC driver. https://www.jooq.org/doc/latest/manual/sql-building/kotlin-sql-building/kotlin-coroutines/
☝️ 1