← ClaudeAtlas

kotlin-exposedlisted

Use when building database access with JetBrains Exposed 1.0.0. Covers newSuspendedTransaction, DSL vs DAO styles, upsert/batchInsert, a custom jsonb ColumnType, UUIDTable definitions, HikariCP and Flyway wiring, H2 test setup, and pinned Gradle coordinates.
Mixard/fable-pack · ★ 1 · AI & Automation · score 74
Install: claude install-skill Mixard/fable-pack
# JetBrains Exposed 1.0.0 Exposed offers two query styles: DSL (SQL-like expressions) and DAO (entity lifecycle). Use DSL for straightforward queries, DAO when you want entity objects with lazy references. In coroutine code, wrap all database work in `newSuspendedTransaction { }`; the block is atomic. Note the 1.0.0 query API shape: `Table.selectAll().where { ... }` (the old `Table.select { ... }` overload is gone; `select(columns)` now takes a column list). ## Gradle dependencies ```kotlin dependencies { implementation("org.jetbrains.exposed:exposed-core:1.0.0") implementation("org.jetbrains.exposed:exposed-dao:1.0.0") implementation("org.jetbrains.exposed:exposed-jdbc:1.0.0") implementation("org.jetbrains.exposed:exposed-kotlin-datetime:1.0.0") implementation("org.jetbrains.exposed:exposed-json:1.0.0") implementation("org.postgresql:postgresql:42.7.5") implementation("com.zaxxer:HikariCP:6.2.1") implementation("org.flywaydb:flyway-core:10.22.0") implementation("org.flywaydb:flyway-database-postgresql:10.22.0") testImplementation("com.h2database:h2:2.3.232") } ``` Flyway 10+ splits Postgres support into `flyway-database-postgresql` — `flyway-core` alone fails at runtime against Postgres. ## HikariCP and Flyway wiring ```kotlin object DatabaseFactory { fun create(config: DatabaseConfig): Database { val hikariConfig = HikariConfig().apply { driverClassName = config.driver // "org.postgresql.Drive