Codync
A free, open-source 1:1 alternative to Grok Bot and Muse. Message Claude Code, Codex, Cursor and 40+ coding agents as persistent bots from your iPhone, Mac or Linux desktop. Group chats, threads, appr
Kotlin ORM for JDBC and R2DBC
Developer toolsKotlin · JavaGitHub @komapperOnlineOwner unconfirmed
Have you tried it? One tap is enough. No sign-in needed.
No updates detected yet. GitHub releases will appear here.
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗Komapper is an ORM library for server-side Kotlin.
For more documentation, go to our site:
Komapper is tested with the following databases:
| Database | version | JDBC support | R2DBC support |
|---|---|---|---|
| H2 Database | 2.3.232 | v | v |
| MariaDB | 11.4.13 | v | v |
| MySQL v5.x | 5.7.44 | v | v |
| MySQL v8.x | 8.0.25 | v | v |
| Oracle Database XE | 18.4.0 | v | v |
| PostgreSQL | 12.9 | v | v |
| SQL Server | 2019 | v | (unstable) |
Supported connectivity types:
Add the following code to the Gradle build script (gradle.build.kts).
plugins {
kotlin("jvm") version "2.4.20"
id("com.google.devtools.ksp") version "2.3.11"
}
val komapperVersion = "7.0.0"
dependencies {
platform("org.komapper:komapper-platform:$komapperVersion").let {
implementation(it)
ksp(it)
}
implementation("org.komapper:komapper-starter-jdbc")
implementation("org.komapper:komapper-dialect-h2-jdbc")
ksp("org.komapper:komapper-processor")
}
See also Quickstart for more details:
To get complete code, go to our example repository.
@KomapperEntity
data class Address(
@KomapperId
@KomapperAutoIncrement
@KomapperColumn(name = "ADDRESS_ID")
val id: Int = 0,
val street: String,
@KomapperVersion
val version: Int = 0,
@KomapperCreatedAt
val createdAt: LocalDateTime? = null,
@KomapperUpdatedAt
val updatedAt: LocalDateTime? = null,
)
fun main() {
// create a Database instance
val db = JdbcDatabase("jdbc:h2:mem:example;DB_CLOSE_DELAY=-1")
// get a metamodel
val a = Meta.address
// execute simple operations in a transaction
db.withTransaction {
// create a schema
db.runQuery {
QueryDsl.create(a)
}
// INSERT
val newAddress = db.runQuery {
QueryDsl.insert(a).single(Address(street = "street A"))
}
// SELECT
val address = db.runQuery {
QueryDsl.from(a).where { a.id eq newAddress.id }.first()
}
}
}
suspend fun main() {
// create a Database instance
val db = R2dbcDatabase("r2dbc:h2:mem:///example;DB_CLOSE_DELAY=-1")
// get a metamodel
val a = Meta.address
// execute simple operations in a transaction
db.withTransaction {
// create a schema
db.runQuery {
QueryDsl.create(a)
}
// INSERT
val newAddress = db.runQuery {
QueryDsl.insert(a).single(Address(street = "street A"))
}
// SELECT
val address = db.runQuery {
QueryDsl.from(a).where { a.id eq newAddress.id }.first()
}
}
}
See DESIGN_DOC for the design policy of this project.
| Kotlin and KSP version | Komapper version | KSP2 support? | JRE min version | Gradle min version |
|---|---|---|---|---|
| 1.9.24-1.0.20 | 1.18.1 - 2.x | No | 11 | 6.8.3 |
| 2.0.21-1.0.28 | 2.x - 5.x | Yes | 11 | 7.6.4 |
| 2.1.21-2.0.2 | 5.x | Yes | 11 | 7.6.4 |
| 2.2.20-2.0.3 | 5.x | Yes | 11 | 7.6.4 |
| 2.3.0 | 5.x - 6.1.0 | Yes | 11 | 8.2 |
| 2.3.21 | 7.0.0 or later | Yes | 17 | 8.2 |
| 2.4.0 | 7.0.0 or later | Yes | 17 | 8.2 |
For Kotlin 2.3.0 and later, KSP is versioned independently of Kotlin (standalone KSP). These rows were verified with KSP 2.3.9.
Compatibility testing is performed in the komapper/compatibility-test repository.
Support Komapper's development on Open Collective.
Organizations
Individuals