Integration overview
Kaumei JDBC keeps runtime integration simple. Generated classes operate on a plain JDBC connection provided through a single interface.
@FunctionalInterfacepublic interface JdbcConnectionProvider { Connection getConnection() throws SQLException;}The Avaje and Spring examples use the same small transaction and run against H2 in-memory databases. Booking a trade updates the customer’s stored net value and inserts the trade. A duplicate UTI makes the insert fail after the customer update, so the tests can verify that Spring rolls back both operations.
The Kaumei JDBC repository keeps the SQL and generated mapping in one interface:
public interface TradeRepositoryKaumei extends TradeRepository {
@JdbcUpdate("DELETE FROM customer_trade") int deleteTrades();
@JdbcUpdate("DELETE FROM trade_customer") int deleteCustomers();
@JdbcUpdate("INSERT INTO trade_customer (:customer.{names}) VALUES (:customer.{values})") void insertCustomer(Customer customer);
@JdbcUpdate(""" UPDATE trade_customer SET total_value = total_value + :delta WHERE id = :customerId """) int adjustTotalValue(long customerId, BigDecimal delta);
@JdbcUpdate("INSERT INTO customer_trade (:trade.{names}) VALUES (:trade.{values})") void insertTrade(Trade trade);
@JdbcSelect("SELECT * FROM trade_customer ORDER BY id") List<Customer> findCustomers();
@JdbcSelect("SELECT * FROM customer_trade ORDER BY executed_at, uti") List<Trade> findTrades();}Each generated class exposes a constructor that accepts a JdbcConnectionProvider.
Every repository method borrows the current connection from that provider.
The generated implementation contract is defined in
JDBC Processor.
In the Spring guides, PlatformTransactionManager owns the transaction
boundaries and jdbc-tx is deliberately not used.
The Avaje guide instead connects Kaumei jdbc-tx to Avaje Inject’s generated
AOP proxy.
See the Transactions guide for the
smallest programmatic jdbc-tx setup.
The exact manager and framework boundaries are defined by
Transaction Manager and
Declarative Transactions.
Provide an implementation that fits your framework. Wire it into your dependency injection container. These guides walk through common scenarios: