#1245 - Refactor internals - Add to TransactionManager externalRemoveTransaction() and externalBeginTransaction()

These provide a better/tidier way for external transaction managers (like ebean-spring-txn) to begin and end externally
managed transactions.
This commit is contained in:
Rob Bygrave
2018-01-31 13:28:42 +13:00
parent 71f66005e7
commit f9cd955f7a
7 changed files with 178 additions and 3 deletions
@@ -0,0 +1,37 @@
package io.ebeaninternal.api;
import io.ebean.TxScope;
import javax.sql.DataSource;
/**
* Service provider interface for the transaction manager.
*/
public interface SpiTransactionManager {
/**
* Return the main DataSource.
*/
DataSource getDataSource();
/**
* Return the read only DataSource (if defined).
*/
DataSource getReadOnlyDataSource();
/**
* Return the currently active transaction (can be null).
*/
SpiTransaction get();
/**
* Push an externally managed transaction into scope (e.g. Spring managed transaction).
*/
ScopedTransaction externalBeginTransaction(SpiTransaction transaction, TxScope txScope);
/**
* Called when an externally managed transaction has completed.
*/
void externalRemoveTransaction();
}