use of org.neo4j.ogm.drivers.bolt.response.RowModelResponse in project neo4j-ogm by neo4j.
the class BoltRequest method execute.
@Override
public Response<RowModel> execute(DefaultRequest query) {
final List<RowModel> rowModels = new ArrayList<>();
String[] columns = null;
for (Statement statement : query.getStatements()) {
Result result = executeRequest(statement);
if (columns == null) {
try {
List<String> columnSet = result.keys();
columns = columnSet.toArray(new String[columnSet.size()]);
} catch (ClientException e) {
throw new CypherException(e.code(), e.getMessage(), e);
}
}
try (RowModelResponse rowModelResponse = new RowModelResponse(result, entityAdapter)) {
RowModel model;
while ((model = rowModelResponse.next()) != null) {
rowModels.add(model);
}
result.consume();
} catch (ClientException e) {
throw new CypherException(e.code(), e.getMessage(), e);
}
}
return new MultiStatementBasedResponse(columns, rowModels);
}
Aggregations