Kotlin Persistence
Talk to SQL and Mongo from Kotlin: JDBC, jOOQ, R2DBC, Spring Data + coroutines, reactive transactions, and MongoDB change streams as a Flow.
- Step 1
JDBC Fundamentals from Kotlin
Talk to any SQL database from Kotlin with raw JDBC โ safely, idiomatically, and without leaking a single connection.
Read lesson - Step 2
jOOQ: Type-Safe SQL as a Kotlin DSL
Write SQL in Kotlin where the compiler โ not production โ catches your typos.
Read lesson - Step 3
R2DBC: Reactive, Non-Blocking Relational Access
JDBC parks a thread per query; R2DBC parks nothing and streams rows as a Publisher you can await with coroutines.
Read lesson - Step 4
Spring Data R2DBC with Coroutines
Reactive database access that reads like blocking code โ suspend for one row, Flow for a stream.
Read lesson - Step 5
Reactive Transactions in Kotlin: @Transactional, TransactionalOperator, and the Coroutine Context
In reactive Spring, a transaction lives in the subscriber context, not on a thread, so one blocking call can silently shatter your atomicity guarantees.
Read lesson - Step 6
Reactive MongoDB with Coroutines
Talk to MongoDB without blocking a single thread โ map documents to data classes and return them as suspend functions or Flow.
Read lesson - Step 7
MongoDB Change Streams as a Kotlin Flow
Turn your database into a live event source by collecting MongoDB change streams as a cold, backpressure-aware Kotlin Flow.
Read lesson - Step 8
Mapping Rows to Immutable Data Classes
Turn raw rows into trustworthy domain objects with companion fromRow factories, null-safe column reads, and copy() for derived updates.
Read lesson