Example usage for org.springframework.jdbc.core.metadata CallMetaDataProvider isReturnResultSetSupported

List of usage examples for org.springframework.jdbc.core.metadata CallMetaDataProvider isReturnResultSetSupported

Introduction

In this page you can find the example usage for org.springframework.jdbc.core.metadata CallMetaDataProvider isReturnResultSetSupported.

Prototype

boolean isReturnResultSetSupported();

Source Link

Document

Does this database support returning ResultSets that should be retrieved with the JDBC call: java.sql.Statement#getResultSet() ?

Usage

From source file:org.springframework.jdbc.core.metadata.CallMetaDataContext.java

/**
 * Create a ReturnResultSetParameter/SqlOutParameter depending on the support provided
 * by the JDBC driver used for the database in use.
 * @param parameterName the name of the parameter (also used as the name of the List returned in the output)
 * @param rowMapper a RowMapper implementation used to map the data returned in the result set
 * @return the appropriate SqlParameter//from w  ww  .j  a v  a2 s. co m
 */
public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper<?> rowMapper) {
    CallMetaDataProvider provider = obtainMetaDataProvider();
    if (provider.isReturnResultSetSupported()) {
        return new SqlReturnResultSet(parameterName, rowMapper);
    } else {
        if (provider.isRefCursorSupported()) {
            return new SqlOutParameter(parameterName, provider.getRefCursorSqlType(), rowMapper);
        } else {
            throw new InvalidDataAccessApiUsageException(
                    "Return of a ResultSet from a stored procedure is not supported.");
        }
    }
}