Source:
public CompletableFuture<List<Map<String, Object>>> get (DataFetchingEnvironment environment) { Map<String, Object> parentEntityMap = environment.getSource(); String namespace = (String) parentEntityMap.get("namespace"); Map<String, Object> graphQLQueryArguemnts = environment.getArguments();; JDBCFetcher lastFetcher = null; List<String> preparedStatementParameters = new ArrayList<>(); Set<String> fromTables = new HashSet<>(); List<String> whereConditions = new ArrayList<>(); for (int i = 0; i < jdbcFetchers.length; i++) { JDBCFetcher fetcher = jdbcFetchers[i]; String tableName = namespacedTableName(namespace, fetcher.tableName); if (i == 0) { List<String> inClauseValues = new ArrayList<>(); Map<String, Object> enclosingEntity = environment.getSource(); String inClauseValue = (String) enclosingEntity.get(fetcher.parentJoinField); if (inClauseValue == null) { return new CompletableFuture<>(); } else { inClauseValues.add(inClauseValue); } fromTables.add(tableName); whereConditions.add(makeInClause( namespacedTableFieldName(namespace, fetcher.tableName, fetcher.parentJoinField), inClauseValues, preparedStatementParameters )); } else { fromTables.add(tableName); whereConditions.add(String.format( "%s = %s", namespacedTableFieldName(namespace, lastFetcher.tableName, fetcher.parentJoinField), namespacedTableFieldName(namespace, fetcher.tableName, fetcher.parentJoinField) )); if (i == jdbcFetchers.length - 1) { StringBuilder sqlStatementStringBuilder = new StringBuilder(); sqlStatementStringBuilder.append("select "); sqlStatementStringBuilder.append( namespacedTableFieldName(namespace, fetcher.tableName, "*") ); return fetcher.getResults( getJdbcQueryDataLoaderFromContext(environment), getDataSourceFromContext(environment), namespace, new ArrayList<>(), graphQLQueryArguemnts, preparedStatementParameters, whereConditions, fromTables, sqlStatementStringBuilder ); } } lastFetcher = fetcher; } return new CompletableFuture<>(); }

Target:
public CompletableFuture<List<Map<String, Object>>> get (DataFetchingEnvironment environment) { Map<String, Object> parentEntityMap = environment.getSource(); String namespace = (String) parentEntityMap.get("namespace"); JDBCFetcher previousFetcher = null; StringBuilder sqlStatementStringBuilder = new StringBuilder(); Set<String> fromTables = new HashSet<>(); List<String> whereConditions = new ArrayList<>(); List<String> preparedStatementParameters = new ArrayList<>(); for (int i = 0; i < jdbcFetchers.length; i++) { JDBCFetcher fetcher = jdbcFetchers[i]; String tableName = namespacedTableName(namespace, fetcher.tableName); if (i == 0) { List<String> inClauseValues = new ArrayList<>(); Map<String, Object> enclosingEntity = environment.getSource(); String inClauseValue = (String) enclosingEntity.get(fetcher.parentJoinField); if (inClauseValue == null) { return new CompletableFuture<>(); } else { inClauseValues.add(inClauseValue); } fromTables.add(tableName); whereConditions.add(makeInClause( namespacedTableFieldName(namespace, fetcher.tableName, fetcher.parentJoinField), inClauseValues, preparedStatementParameters )); } else { fromTables.add(tableName); whereConditions.add(String.format( "%s = %s", namespacedTableFieldName(namespace, previousFetcher.tableName, fetcher.parentJoinField), namespacedTableFieldName(namespace, fetcher.tableName, fetcher.parentJoinField) )); if (i == jdbcFetchers.length - 1) { sqlStatementStringBuilder.append("select "); sqlStatementStringBuilder.append( namespacedTableFieldName(namespace, fetcher.tableName, "*") ); } } previousFetcher = fetcher; } return previousFetcher.getResults( environment, sqlStatementStringBuilder.toString(), fromTables, whereConditions, preparedStatementParameters ); }