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

The following examples show how to use org.springframework.dao.support.DataAccessUtils#nullableSingleResult() . 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 spring-analysis-note with MIT License 5 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, Object[] args, int[] argTypes, RowMapper<T> rowMapper)
		throws DataAccessException {

	List<T> results = query(sql, args, argTypes, new RowMapperResultSetExtractor<>(rowMapper, 1));
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 2
Source File: NamedParameterJdbcTemplate.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, SqlParameterSource paramSource, RowMapper<T> rowMapper)
		throws DataAccessException {

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

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

	List<T> results = getJdbcOperations().query(getPreparedStatementCreator(sql, paramSource), rowMapper);
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 5
Source File: JdbcTemplate.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, rowMapper);
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 6
Source File: JdbcTemplate.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, @Nullable Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<>(rowMapper, 1));
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 7
Source File: JdbcTemplate.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<>(rowMapper, 1));
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 8
Source File: JdbcTemplate.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, rowMapper);
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 9
Source File: JdbcTemplate.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, @Nullable Object[] args, RowMapper<T> rowMapper) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<>(rowMapper, 1));
	return DataAccessUtils.nullableSingleResult(results);
}
 
Example 10
Source File: JdbcTemplate.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
@Nullable
public <T> T queryForObject(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws DataAccessException {
	List<T> results = query(sql, args, new RowMapperResultSetExtractor<>(rowMapper, 1));
	return DataAccessUtils.nullableSingleResult(results);
}