private void executeQuery(QueryExecution<?> queryExecution) throws SortJdbcException, PreparingPersistStatementException, SortQueryException {
  List<Param> params=new LinkedList<Param>();
  String sql=queryExecution.getSql(params);
  LOG.debug("============================================");
  LOG.debug("Executing individual query:\n" + sql);
  if (!params.isEmpty()) {
    try (PreparedStatement stmt=prepareStatement(sql,runtimeProperties)){
      setFetch(stmt,runtimeProperties);
      setParameters(stmt,params);
      try (ResultSet resultSet=stmt.executeQuery()){
        queryExecution.processResultSet(resultSet);
      }
 catch (      SQLException x) {
        throw new SortJdbcException("SQLException executing the prepared statement query",x);
      }
    }
 catch (    SQLException x) {
      throw new PreparingPersistStatementException("SQLException preparing statement",x);
    }
  }
 else {
    try (Statement stmt=createStatement(runtimeProperties)){
      setFetch(stmt,runtimeProperties);
      try (ResultSet resultSet=stmt.executeQuery(sql)){
        queryExecution.processResultSet(resultSet);
      }
 catch (      SQLException x) {
        throw new SortJdbcException("SQLException executing the statement query",x);
      }
    }
 catch (    SQLException x) {
      throw new SortJdbcException("SQLException creating statement",x);
    }
  }
}

private void executeQuery ( QueryExecution < ? > queryExecution ) throws SortJdbcException , PreparingPersistStatementException , SortQueryException { List < Param > params = new LinkedList < Param > ( ) ; String sql = queryExecution . getSql ( params ) ; LOG . debug ( "============================================" ) ; LOG . debug ( "Executing individual query:\n" + sql ) ; if ( ! params . isEmpty ( ) ) { try ( PreparedStatement stmt = prepareStatement ( sql , runtimeProperties ) ) { setFetch ( stmt , runtimeProperties ) ; setParameters ( stmt , params ) ; try ( ResultSet resultSet = stmt . executeQuery ( ) ) { queryExecution . processResultSet ( resultSet ) ; } catch ( SQLException x ) { throw new SortJdbcException ( "SQLException executing the prepared statement query" , x ) ; } } catch ( SQLException x ) { throw new PreparingPersistStatementException ( "SQLException preparing statement" , x ) ; } } else { try ( Statement stmt = createStatement ( runtimeProperties ) ) { setFetch ( stmt , runtimeProperties ) ; try ( ResultSet resultSet = stmt . executeQuery ( sql ) ) { queryExecution . processResultSet ( resultSet ) ; } catch ( SQLException x ) { throw new SortJdbcException ( "SQLException executing the statement query" , x ) ; } } catch ( SQLException x ) { throw new SortJdbcException ( "SQLException creating statement" , x ) ; } } }
executes a single query expecting one resultset .
