Java Code Examples for org.springframework.dao.support.DataAccessUtils#requiredSingleResult()

The following examples show how to use org.springframework.dao.support.DataAccessUtils#requiredSingleResult() . 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: JdbcTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = query(sql, args, argTypes, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 2
Source File: NamedParameterJdbcTemplate.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public <T> T queryForObject(String sql, SqlParameterSource paramSource, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = getJdbcOperations().query(getPreparedStatementCreator(sql, paramSource), rowMapper);
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 3
Source File: JdbcTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = query(sql, args, argTypes, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 4
Source File: NamedParameterJdbcTemplate.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T queryForObject(String sql, SqlParameterSource paramSource, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = getJdbcOperations().query(getPreparedStatementCreator(sql, paramSource), rowMapper);
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 5
Source File: JdbcTemplate.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = query(sql, args, argTypes, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 6
Source File: NamedParameterJdbcTemplate.java    From effectivejava with Apache License 2.0 5 votes vote down vote up
@Override
public <T> T queryForObject(String sql, SqlParameterSource paramSource, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = getJdbcOperations().query(getPreparedStatementCreator(sql, paramSource), rowMapper);
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 7
Source File: JdbcTemplate.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, rowMapper);
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 8
Source File: JdbcTemplate.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 9
Source File: JdbcTemplate.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 10
Source File: JdbcTemplate.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, rowMapper);
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 11
Source File: JdbcTemplate.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 12
Source File: JdbcTemplate.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 13
Source File: JdbcTemplate.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, rowMapper);
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 14
Source File: JdbcTemplate.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}
 
Example 15
Source File: JdbcTemplate.java    From effectivejava with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T queryForObject(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<T>(rowMapper, 1));
	return DataAccessUtils.requiredSingleResult(results);
}