Skip to content
0:00 / 0:00

#jooq#contextreceivers#transactions

jOOQ Transactions with Kotlin Context Receivers

Pairing with Duncan

4.5K subscribers • 13 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • Linked in the descriptiondmcg/gilded-rose-tdd
  • May be out of date. The tools, versions or practices it shows have likely moved on.

Intermediate. Assumes working knowledge.

1.4K views3 years ago1 recommendation

Databases and dataProgramming languagesKotlinPostgresSQL

Duncan McGregor demonstrates how to use Kotlin context receivers to manage database transactions cleanly with jOOQ.

In our last episode (youtu.be/6Ji9yKnZ3D8), Lukas Eder from jOOQ - the Java Object Oriented Query library (jooq.org/), left us with working code, but no way of delimiting transactions. In our Exposed implementation we use Kotlin context receivers to ensure that database access code is running inside a transaction, so we would like to do the same here. jOOQ allows us to take one of its DSL objects, start a transaction on it, and pass that around. So we use that facility, carefully managing scope functions to make sure that transactions are completed. We also find a way to write a test that shows what information is visible between transactions. This is part 70 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin. You can see the whole series as a playlist youtube.com/playlist?list=PL1ssMPpyqociJNwykAOB9_KEZVW7BW7m2 and the code on GitHub github.com/dmcg/gilded-rose-tdd Other database-specific episodes are collected in a playlist youtube.com/playlist?list=PL1ssMPpyqoci7HFHOmNbzkT_OAVqr9JBu If you like this, you’ll probably like my book Java to Kotlin, A Refactoring Guidebook (java-to-kotlin.dev). It's about far more than just the syntax differences between the languages - it shows how to upgrade your thinking to a more functional style. I have some free time between producing videos and working for team Gilded Rose. If you like these videos I'd like to work with you - please get in touch - duncan@oneeyedmen.com

Why it's here

1 person recommends this

What people say. Recommended as a practical guide to managing jOOQ transactions using Kotlin context receivers.

u/dmcgin r/Kotlin • Recommends

jOOQ Transactions with Kotlin Context Receivers