I loaded close to 10k and 41k relationships nodes in the database and i 
then tried to delete all of the nodes and relationships. This is the 
following code below.

public static void main(String[] args) {

         graphDb = new EmbeddedGraphDatabase(DB_PATH);
         nodeIndex = graphDb.index().forNodes(INDEX_NAME);
         GraphDbMethods.registerShutdownHook(graphDb);
         Transaction tx = graphDb.beginTx();
         Iterable<Node> allNodes = graphDb.getAllNodes();
         for (Node node : allNodes) {
             if (node.getId() != 0) {
                 if (node.getId() != 0) {
                     Iterable<Relationship> rel = node.getRelationships();
                     for (Relationship relationship : rel) {
                         relationship.delete(); // error occurs here
                     }
                     node.delete();
                 }
                 nodeIndex.remove(node);
             }
         }

         tx.success();
         tx.finish();
         System.out.println("Shutting down database ...");
         graphDb.shutdown();
     }


I get the " illegalStateException:Relationship[3130] has been deleted in 
this tx" error and this transaction rolls back.

Plz help

Akhillius

_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to