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

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

Introduction

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

Prototype

int getRefCursorSqlType();

Source Link

Document

Get the java.sql.Types type for columns that return ResultSets as ref cursors if this feature is supported.

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   ww w . j  a  va 2  s.  c  o  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.");
        }
    }
}