Java Code Examples for org.springframework.jdbc.core.SqlReturnResultSet

The following examples show how to use org.springframework.jdbc.core.SqlReturnResultSet. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: CallMetaDataContext.java    License: MIT License 6 votes vote down vote up
/**
 * 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) {
	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");
		}
	}
}
 
Example 2
Source Project: java-technology-stack   Source File: CallMetaDataContext.java    License: MIT License 6 votes vote down vote up
/**
 * 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) {
	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");
		}
	}
}
 
Example 3
Source Project: lams   Source File: CallMetaDataContext.java    License: GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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.");
		}
	}
}
 
Example 4
Source Project: spring4-understanding   Source File: CallMetaDataContext.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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.");
		}
	}
}
 
Example 5
Source Project: effectivejava   Source File: CallMetaDataContext.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 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.");
		}
	}
}
 
Example 6
Source Project: spring-analysis-note   Source File: StoredProcedureTests.java    License: MIT License 4 votes vote down vote up
public StoredProcedureWithResultSet(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", this.handler));
	compile();
}
 
Example 7
Source Project: spring-analysis-note   Source File: StoredProcedureTests.java    License: MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 8
Source Project: spring-analysis-note   Source File: StoredProcedureTests.java    License: MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) {
	setJdbcTemplate(jt);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 9
Source Project: java-technology-stack   Source File: StoredProcedureTests.java    License: MIT License 4 votes vote down vote up
public StoredProcedureWithResultSet(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", this.handler));
	compile();
}
 
Example 10
Source Project: java-technology-stack   Source File: StoredProcedureTests.java    License: MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 11
Source Project: java-technology-stack   Source File: StoredProcedureTests.java    License: MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) {
	setJdbcTemplate(jt);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 12
public StoredProcedureWithResultSet(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", this.handler));
	compile();
}
 
Example 13
public StoredProcedureWithResultSetMapped(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 14
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) {
	setJdbcTemplate(jt);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 15
Source Project: effectivejava   Source File: StoredProcedureTests.java    License: Apache License 2.0 4 votes vote down vote up
public StoredProcedureWithResultSet(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", this.handler));
	compile();
}
 
Example 16
Source Project: effectivejava   Source File: StoredProcedureTests.java    License: Apache License 2.0 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example 17
Source Project: effectivejava   Source File: StoredProcedureTests.java    License: Apache License 2.0 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) {
	setJdbcTemplate(jt);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}