Skip to content

Kotysa for Spring JDBC

Dependency

kotysa-spring-jdbc is a single dependency you can add to your Spring project.
This is a companion version for spring-jdbc 6.0.x (included in Spring boot 3.0.X) and does not replace it.

groovy
repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.ufoss.kotysa:kotysa-spring-jdbc:3.2.2'
    
    implementation 'org.springframework:spring-jdbc'
}

Check this sample project for a Spring Boot Servlet WebMVC application with a JDBC backend accessed via kotysa-spring-jdbc

Usage

kotysa-spring-jdbc provides a SQL client on top of spring-jdbc, it can be obtained via an Extension function directly on spring-jdbc's JdbcOperations.

kotlin
class Repository(client: JdbcOperations, tables: H2Tables) {

	private val sqlClient = client.sqlClient(tables)

	// enjoy sqlClient for spring-jdbc :)
}

Supported databases

Transaction

kotysa-spring-jdbc provides a transaction on top of spring-tx, it can be obtained via an Extension function directly on spring-tx's TransactionOperations.

kotlin
class Service(template: TransactionOperations) {

	private val operator = template.transactionalOp()

	// use transaction
}

Released under The Unlicense.