This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Run the application
./gradlew run
# Build the project (compile and test)
./gradlew build
# Run tests
./gradlew test
# Run a single test class
./gradlew test --tests ApplicationTest
# Clean build artifacts
./gradlew clean
# Compile without running tests
./gradlew assemble# Check code (runs all verification tasks)
./gradlew check
# Generate KSP code (happens automatically during build)
./gradlew kspKotlinThis is a Komapper quickstart project demonstrating the Komapper ORM framework for Kotlin. Komapper provides type-safe database access with compile-time code generation via KSP (Kotlin Symbol Processing).
-
Entity Definition with Annotations
- Entities are defined as immutable data classes with Komapper annotations
@KomapperEntitymarks a class as a database entity@KomapperIdwith@KomapperAutoIncrementfor primary keys@KomapperVersionfor optimistic locking@KomapperCreatedAt/@KomapperUpdatedAtfor automatic timestamps
-
Code Generation via KSP
- KSP generates metamodel classes (e.g.,
_Employee) at compile time - Metamodels provide type-safe property references accessed via
Meta.employee - No runtime reflection, improving performance
- KSP generates metamodel classes (e.g.,
-
Type-Safe Query DSL
- All database operations use Komapper's type-safe DSL
- Queries are built using
QueryDslwith compile-time verification - Example:
QueryDsl.from(e).where { e.name eq "John" }
-
Transaction Management
- Explicit transactions using
database.withTransaction { ... } - All operations within the block are atomic
- Explicit transactions using
src/main/kotlin/org/komapper/quickstart/Application.kt- Main entry point demonstrating Komapper usageEmployee.kt- Entity definition with Komapper annotations
build/generated/ksp/- Generated metamodel classes (created during build)- Database: Uses H2 in-memory database for the example
- Kotlin Version: 2.1.21
- Komapper Version: 5.3.0
- Target JVM: Java 11
- KSP: Version 2.1.21-2.0.2 with KSP2 enabled
- Testing: JUnit 5 (Jupiter)
For detailed Komapper documentation, refer to: https://www.komapper.org/docs/quickstart/