Search in sources :

Example 1 with TransactionProvider

use of org.jooq.TransactionProvider in project jOOQ by jOOQ.

the class DefaultConfiguration method connectionProvider.

// -------------------------------------------------------------------------
// XXX: Getters
// -------------------------------------------------------------------------
@Override
public final ConnectionProvider connectionProvider() {
    // [#3229] [#5377] If we're currently in a transaction, return that transaction's
    // local DefaultConnectionProvider, not the one from this configuration
    TransactionProvider tp = transactionProvider();
    ConnectionProvider transactional = tp instanceof ThreadLocalTransactionProvider ? ((ThreadLocalTransactionProvider) tp).localConnectionProvider : (ConnectionProvider) data(DATA_DEFAULT_TRANSACTION_PROVIDER_CONNECTION);
    return transactional != null ? transactional : connectionProvider != null ? connectionProvider : new NoConnectionProvider();
}
Also used : TransactionProvider(org.jooq.TransactionProvider) ThreadLocalConnectionProvider(org.jooq.impl.ThreadLocalTransactionProvider.ThreadLocalConnectionProvider) ConnectionProvider(org.jooq.ConnectionProvider)

Aggregations

ConnectionProvider (org.jooq.ConnectionProvider)1 TransactionProvider (org.jooq.TransactionProvider)1 ThreadLocalConnectionProvider (org.jooq.impl.ThreadLocalTransactionProvider.ThreadLocalConnectionProvider)1