Transaction Support¶
FluDa Transaction Support provides container-agnostic declarative and programmatic transaction boundaries backed directly by a standard DataSource or JPA.
How it works¶
Depending on the runtime, applications can participate in database transactions in two ways:
- Java SE or a Servlet container — use the
fluda-txmodules for resource-local transactions. A CDI interceptor honorsjakarta.transaction.Transactionalover a plain JDBCDataSource, with no JTA required. - A full Jakarta EE runtime (WildFly, GlassFish, Payara, Open Liberty, ...) — the container ships a JTA implementation, so
jakarta.transaction.Transactionalworks out of the box and thefluda-txmodules are unnecessary.
Modules¶
| Module | Description |
|---|---|
fluda-tx-core |
Core SPI: PlatformTransactionManager, exceptions, and synchronization infrastructure. |
fluda-tx-cdi |
CDI extension and @Transactional interceptor. |
fluda-tx-jdbc |
Resource-local DataSourceTransactionManager and TransactionAwareDataSourceProxy. |
fluda-tx-jpa |
JPA-based transaction manager with EntityManager integration. |
Key concepts¶
PlatformTransactionManager— the SPI that abstracts transaction begin/commit/rollback. Thefluda-tx-jdbcmodule provides aDataSourceTransactionManagerfor resource-local JDBC transactions.TransactionAwareDataSourceProxy— wraps a rawDataSourceso thatgetConnection()returns the transaction-bound connection inside an active transaction, andclose()is suppressed.- CDI interceptor — auto-registered by
fluda-tx-cdi, drives the transaction lifecycle around@Transactionalmethods.
See the getting started guide to add dependencies and set up a minimal example, the JDBC implementation page for DataSource-based transactions, the JPA implementation page for EntityManager-based transactions, and advanced topics for multiple DataSources and mixing JPA with JDBC.