Example usage for org.springframework.jca.cci InvalidResultSetAccessException InvalidResultSetAccessException

List of usage examples for org.springframework.jca.cci InvalidResultSetAccessException InvalidResultSetAccessException

Introduction

In this page you can find the example usage for org.springframework.jca.cci InvalidResultSetAccessException InvalidResultSetAccessException.

Prototype

public InvalidResultSetAccessException(String msg, SQLException ex) 

Source Link

Document

Constructor for InvalidResultSetAccessException.

Usage

From source file:org.cloudfoundry.identity.uaa.scim.jdbc.JdbcScimGroupExternalMembershipManager.java

@Override
public ScimGroupExternalMember unmapExternalGroup(final String groupId, final String externalGroup,
        final String origin) throws ScimResourceNotFoundException {

    ScimGroup group = scimGroupProvisioning.retrieve(groupId);
    ScimGroupExternalMember result = getExternalGroupMap(groupId, externalGroup, origin);
    if (null != group && null != result) {
        int count = jdbcTemplate.update(DELETE_EXTERNAL_GROUP_MAPPING_SQL, new PreparedStatementSetter() {
            @Override// ww w.ja  v a  2  s. c o  m
            public void setValues(PreparedStatement ps) throws SQLException {
                ps.setString(1, groupId);
                ps.setString(2, externalGroup);
                ps.setString(3, origin);
            }
        });
        if (count == 1) {
            return result;
        } else if (count == 0) {
            throw new ScimResourceNotFoundException("No group mappings deleted.");
        } else {
            throw new InvalidResultSetAccessException("More than one mapping deleted count=" + count,
                    new SQLException());
        }
    } else {
        return null;
    }
}

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

@Override
@Nullable//w  ww .j av  a 2 s.  co  m
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());
    }
}