Example usage for org.springframework.jca.cci.core ConnectionCallback doInConnection

List of usage examples for org.springframework.jca.cci.core ConnectionCallback doInConnection

Introduction

In this page you can find the example usage for org.springframework.jca.cci.core ConnectionCallback doInConnection.

Prototype

@Nullable
T doInConnection(Connection connection, ConnectionFactory connectionFactory)
        throws ResourceException, SQLException, DataAccessException;

Source Link

Document

Gets called by CciTemplate.execute with an active CCI Connection.

Usage

From source file:org.springframework.jca.cci.core.CciTemplate.java

@Override
@Nullable//from  ww  w  . jav a  2s. c  om
public <T> T execute(ConnectionCallback<T> action) throws DataAccessException {
    Assert.notNull(action, "Callback object must not be null");
    ConnectionFactory connectionFactory = obtainConnectionFactory();
    Connection con = ConnectionFactoryUtils.getConnection(connectionFactory, getConnectionSpec());
    try {
        return action.doInConnection(con, connectionFactory);
    } catch (NotSupportedException ex) {
        throw new CciOperationNotSupportedException("CCI operation not supported by connector", ex);
    } catch (ResourceException ex) {
        throw new DataAccessResourceFailureException("CCI operation failed", ex);
    } catch (SQLException ex) {
        throw new InvalidResultSetAccessException("Parsing of CCI ResultSet failed", ex);
    } finally {
        ConnectionFactoryUtils.releaseConnection(con, getConnectionFactory());
    }
}