org.springframework.jdbc.core.SqlReturnResultSet Java Examples

The following examples show how to use org.springframework.jdbc.core.SqlReturnResultSet. 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 File: CallMetaDataContext.java    From spring-analysis-note with 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 File: CallMetaDataContext.java    From java-technology-stack with 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 File: CallMetaDataContext.java    From effectivejava with 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 #4
Source File: CallMetaDataContext.java    From lams with 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 #5
Source File: CallMetaDataContext.java    From spring4-understanding with 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 File: StoredProcedureTests.java    From effectivejava with 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();
}
 
Example #7
Source File: StoredProcedureTests.java    From effectivejava with 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 #8
Source File: StoredProcedureTests.java    From effectivejava with 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 #9
Source File: StoredProcedureTests.java    From spring4-understanding with 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();
}
 
Example #10
Source File: StoredProcedureTests.java    From spring4-understanding with 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 #11
Source File: StoredProcedureTests.java    From spring4-understanding with 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 #12
Source File: StoredProcedureTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) {
	setJdbcTemplate(jt);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example #13
Source File: StoredProcedureTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example #14
Source File: StoredProcedureTests.java    From java-technology-stack with MIT License 4 votes vote down vote up
public StoredProcedureWithResultSet(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", this.handler));
	compile();
}
 
Example #15
Source File: StoredProcedureTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(JdbcTemplate jt) {
	setJdbcTemplate(jt);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example #16
Source File: StoredProcedureTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public StoredProcedureWithResultSetMapped(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", new RowMapperImpl()));
	compile();
}
 
Example #17
Source File: StoredProcedureTests.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public StoredProcedureWithResultSet(DataSource ds) {
	setDataSource(ds);
	setSql(SQL);
	declareParameter(new SqlReturnResultSet("rs", this.handler));
	compile();
}