Hi, i'm new to neo4j and i have a problem. I need to delete all the relationships that i have inserted and i execute two times this function
public static void deleteRelationships(){
ArrayList<Node> listnodes =getNodes();
Transaction tx = graphDb.beginTx();
int cnt=0;
try
{
for (int i = 0; i < listnodes.size(); i++) {
Iterator<Relationship> iter = listnodes.get(i).getRelationships().iterator();
while(iter.hasNext())
{iter.next().delete();
cnt++;
}
}
}
catch (Exception e)
{
tx.failure();
e.printStackTrace();
}
finally
{
System.out.println("relationships deleted "+cnt);
tx.finish();
}
}
this function print 1600 two times. Anyone can help me? Thanks