Search in sources :

Example 1 with VTransaction

use of io.vertigo.commons.transaction.VTransaction in project vertigo by KleeGroup.

the class AbstractTaskEngineSQL method obtainConnection.

/**
 * Retourne la connexion SQL de cette transaction en la demandant au pool de connexion si nécessaire.
 * @return Connexion SQL
 */
private SqlConnection obtainConnection() {
    final VTransaction transaction = transactionManager.getCurrentTransaction();
    SqlConnection connection = transaction.getResource(getVTransactionResourceId());
    if (connection == null) {
        // On récupère une connexion du pool
        // Utilise le provider de connexion déclaré sur le Container.
        connection = getConnectionProvider().obtainConnection();
        transaction.addResource(getVTransactionResourceId(), connection);
    }
    return connection;
}
Also used : VTransaction(io.vertigo.commons.transaction.VTransaction) SqlConnection(io.vertigo.database.sql.connection.SqlConnection)

Example 2 with VTransaction

use of io.vertigo.commons.transaction.VTransaction in project vertigo by KleeGroup.

the class BerkeleyDatabase method getCurrentBerkeleyTransaction.

private Transaction getCurrentBerkeleyTransaction() {
    final VTransaction transaction = transactionManager.getCurrentTransaction();
    BerkeleyResource berkeleyResource = transaction.getResource(berkeleyResourceId);
    if (berkeleyResource == null) {
        // On a rien trouvé il faut créer la resourceLucene et l'ajouter à la transaction
        berkeleyResource = new BerkeleyResource(database.getEnvironment());
        transaction.addResource(berkeleyResourceId, berkeleyResource);
    }
    return berkeleyResource.getBerkeleyTransaction();
}
Also used : VTransaction(io.vertigo.commons.transaction.VTransaction)

Aggregations

VTransaction (io.vertigo.commons.transaction.VTransaction)2 SqlConnection (io.vertigo.database.sql.connection.SqlConnection)1