Skip to content

Installation

Kaumei JDBC supports Java 17 or newer. Your project also needs:

  • a JDBC driver for your database
  • annotation processing enabled in your build or IDE

Use the same Kaumei JDBC version for all artifacts.

Artifact Role Where it belongs
io.kaumei.jdbc:jdbc-annotation Annotations used in your source code. Compile time
io.kaumei.jdbc:jdbc-core Runtime API used by generated code. Compile time and runtime
io.kaumei.jdbc:jdbc-processor Annotation processor. Annotation processor path
io.kaumei.jdbc:jdbc-tx Optional local JDBC transaction manager. Compile time and runtime when used

The runtime classpath stays small. Generated JDBC code itself needs jdbc-core, jdbc-annotation, JSpecify annotations, and your JDBC driver. Applications that use Kaumei-owned local transaction boundaries additionally need jdbc-tx. Processor-only dependencies such as JavaPoet stay on the annotation processor path and are not needed at runtime.

The Transactions guide shows how to configure jdbc-tx and run local transactions.

Application code may use types declared in io.kaumei.jdbc.core and io.kaumei.jdbc.tx, and types in io.kaumei.jdbc.annotation and its subpackages. These packages form the supported public API.

The io.kaumei.jdbc.core.internal and io.kaumei.jdbc.tx.internal packages contain implementation details. Although some of their public types are visible on the compile classpath, application code must not use them directly. Internal types may change or be removed without notice and are not covered by API compatibility guarantees.

The Maven example below shows the required dependency roles.

For the latest published version see Maven Central Repository.

pom.xml
<properties>
<kaumei-jdbc.version>develop-SNAPSHOT</kaumei-jdbc.version>
</properties>
<dependencies>
<dependency>
<groupId>io.kaumei.jdbc</groupId>
<artifactId>jdbc-annotation</artifactId>
<version>${kaumei-jdbc.version}</version>
</dependency>
<dependency>
<groupId>io.kaumei.jdbc</groupId>
<artifactId>jdbc-core</artifactId>
<version>${kaumei-jdbc.version}</version>
</dependency>
</dependencies>

Configure the annotation processor path:

pom.xml
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.kaumei.jdbc</groupId>
<artifactId>jdbc-processor</artifactId>
<version>${kaumei-jdbc.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Aio.kaumei.jdbc.processor.config=io.kaumei.jdbc.spec.ConfigSpec</arg>
</compilerArgs>
</configuration>
</plugin>

Use the same dependency roles with other build tools:

  • add jdbc-annotation for compilation
  • add jdbc-core for compilation and runtime
  • add jdbc-processor to the annotation processor path
  • add jdbc-tx for compilation and runtime when using Kaumei-owned local transaction boundaries

Do not put jdbc-processor on the application runtime classpath unless your build tool requires that internally.

When importing a project, make sure annotation processing is enabled.

Open Build, Execution, Deployment > Compiler > Annotation Processors and tick Enable annotation processing.