It appears that you can only iterate once through the rows in an ExecutionResult
. The columnAs()
method iterates through all the rows, but only returns the values from a single column. A second call to columnAs()
will return no values because you are already at the end of the ExecutionResult
.
You will need to restructure your logic and use the iterator()
method instead, processing a row at a time.
To quote the JavaDoc for iterator():
public ResourceIterator<Map<String,Object>> iterator()
Returns an iterator over the return clause of the query. The format is a map that has as keys the names of the columns or their explicit names (set via 'as') and the value is the calculated value. Each iterator item is one row of the query result.
In other words, each pass through an iterator()
loop provides a Map containing the columns for a result row. Each key in the Map is the name of a column, and the value for each key is that column's data.