public static <T>T selectOne(Connection connection,String rawSqlQuery,RowProcessor<T> rowProcessor,Object... parameters) throws IOException, SQLException {
  List<T> resultList=JdbcUtils.select(connection,rawSqlQuery,rowProcessor,parameters);
  if (resultList.isEmpty()) {
    return null;
  }
 else   if (resultList.size() == 1) {
    return resultList.get(0);
  }
 else {
    throw new SQLException(String.format("Too many rows returned: %d",resultList.size()));
  }
}

public static < T > T selectOne ( Connection connection , String rawSqlQuery , RowProcessor < T > rowProcessor , Object ... parameters ) throws IOException , SQLException { List < T > resultList = JdbcUtils . select ( connection , rawSqlQuery , rowProcessor , parameters ) ; if ( resultList . isEmpty ( ) ) { return null ; } else if ( resultList . size ( ) == 1 ) { return resultList . get ( 0 ) ; } else { throw new SQLException ( String . format ( "Too many rows returned: %d" , resultList . size ( ) ) ) ; } }
a convenience method when only one row is expected from the returned result set . when there are no rows satisfying the criteria , null is returned ; when there are more than one row satisfying the criteria , dataservicesruntimeexception is thrown .
