I am currently using Neo4j Graph Database. I am trying to traverse nodes starting from a startNode in parallel. Following is the code:
neo4jDb.getTraversalDescription().depthFirst().
relationships(RelationshipType.withName("R1"),Direction.OUTGOING).traverse(startNode).nodes().stream().parallel().foreach(node->{Transaction tx = neo4j.beginTX();//perform some operation on each node.
tx.success();});
It gives the error : The requested operation cannot be performed, because it has to be performed in a transaction. Ensure you are wrapping your operation in the appropriate transaction boilerplate and try again.
How do i proceed ?