/** * 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 */ public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper<?> rowMapper) { if (this.metaDataProvider.isReturnResultSetSupported()) { return new SqlReturnResultSet(parameterName, rowMapper); } else { if (this.metaDataProvider.isRefCursorSupported()) { return new SqlOutParameter(parameterName, this.metaDataProvider.getRefCursorSqlType(), rowMapper); } else { throw new InvalidDataAccessApiUsageException("Return of a ResultSet from a stored procedure is not supported."); } } }
/** * 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 */ public SqlParameter createReturnResultSetParameter(String parameterName, RowMapper rowMapper) { if (this.metaDataProvider.isReturnResultSetSupported()) { return new SqlReturnResultSet(parameterName, rowMapper); } else { if (this.metaDataProvider.isRefCursorSupported()) { return new SqlOutParameter(parameterName, this.metaDataProvider.getRefCursorSqlType(), rowMapper); } else { throw new InvalidDataAccessApiUsageException("Return of a ResultSet from a stored procedure is not supported."); } } }
public StoredProcedureWithResultSet(DataSource ds) { setDataSource(ds); setSql(SQL); declareParameter(new SqlReturnResultSet("rs", this.handler)); compile(); }
public StoredProcedureWithResultSetMapped(DataSource ds) { setDataSource(ds); setSql(SQL); declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl())); compile(); }
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) { setJdbcTemplate(jt); setSql(SQL); declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl())); compile(); }