org.springframework.dao.EmptyResultDataAccessException: неверный размер результата: ожидается 1, фактический 0
NamedParameterJdbcTemplate jdbcTemplate;
@Autowired
public void setJdbcTemplate(NamedParameterJdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
@Override
public UserDetailModel getUserDetail(UserDetailModel detailModel) throws ClassNotFoundException, SQLException {
StringBuilder query = new StringBuilder();
Map map = new HashMap();
SqlParameterSource param;
query.append(" select ");
query.append(" bu.FIRST_NAME as 'firstname', bu.LAST_NAME as 'lastname', bu.EMAIL as 'email', MOBILE as 'mobile', bu.ID as 'id', ");
query.append(" bu.ENABLED as 'enable', bu.IS_ADMIN as 'isadmin', bu.USERNAME as 'username', bu.PASSWORD as 'password' ");
query.append(" from bamboo_users bu ");
query.append(" where upper(trim(bu.USERNAME))=upper(trim(:USERNAME)) ");
query.append(" AND ENABLED='1' ");
map.put("USERNAME", detailModel.getUsername());
param = new MapSqlParameterSource(map);
return (UserDetailModel) jdbcTemplate.queryForObject(query.toString(), map, new UserRowMappers());
}