Skip to content

Transactions

Zsolt Herpai edited this page Feb 6, 2015 · 13 revisions

All queries will be executed in transactions as long as Connections provided by the ConnectionProvider are transaction-managed. This is possible in a number of ways:

Using a transaction-aware DataSource

Many frameworks provide transaction-aware DataSources. If's ConnectionProvider is based on such a DataSource, all FluentJdbc operations will be executed as part of the current transaction (if any). See integration pages for concrete examples:

Using the underlying connections of JPA

The underlying connection of a JPA session can be extracted from the EntityManager. See integration pages for detailed examples:

  • JPA integration
  • Guice Persist integration (provided as module)
Transaction-managed Connection callback

Some frameworks provide transaction-management through Connection callbacks. The API of ConnectionProvider makes these easy to integrate with. See integration page for examples:

Standalone transaction-management with GuicePersist (non-JPA)

Guice Persist transaction-management / annotations can be used without JPA. FluentJdbc Guice Persist extension library provides a module for this:

  • Guice Persist integration (provided as module)
Custom ConnectionProvider

Custom ConnectionProvider can be implemented to integrate with other transaction-management solutions.