Installation
Requirements
Section titled “Requirements”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
Artifacts
Section titled “Artifacts”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.
Public API
Section titled “Public API”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.
Maven example
Section titled “Maven example”The Maven example below shows the required dependency roles.
For the latest published version see Maven Central Repository.
<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:
<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>Other build tools
Section titled “Other build tools”Use the same dependency roles with other build tools:
- add
jdbc-annotationfor compilation - add
jdbc-corefor compilation and runtime - add
jdbc-processorto the annotation processor path - add
jdbc-txfor 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.
IntelliJ IDEA
Section titled “IntelliJ IDEA”When importing a project, make sure annotation processing is enabled.
Open Build, Execution, Deployment > Compiler > Annotation Processors
and tick Enable annotation processing.