2010/12/7 Andreas Ronge <andreas.ro...@gmail.com>

> Hi
>
> I want to avoid keeping track if a node has been deleted or not.
> How can I implemented this ?
>
> I tried to simply catch the exception but then I can't commit the
> transaction.
>
>  Node node = db.createNode()
>  try {
>    node.delete()
>    node.delete()
>  } catch { }
>  tx.success
>  tx.finish  // BANG - org.neo4j.graphdb.TransactionFailureException:
> Unable to commit transaction
>
> The same applies for deleting relationships.
>

Maybe it could be allowed to delete a node more than once in the same
transaction... I don't know what drawbacks that would have?


>
> Also, it would be great if there was a force parameter on the delete
> method.
>
> I would prefer a boolean if the delete was successful or not instead
> of an Exception
> (same for with node.getSingleRelationship() and maybe other methods)
>
> In saw on the list that other people also have requested a similar
> feature, Alexandru Popescu:
> >2. I was surprised to see a `Node`.delete() failing. The reason was it
> >had relationships. I think adding a method `Node`.delete(boolean
> >force) would
> >make code much easier. The method would automatically:
> >
> >- remove all relationships
>

This one has been discussed since the dawn of time. It can potentially have
unexpected side effects on your graph by deleting relationships it maybe
wasn't aware of was connected to it. But if that's what (a lot of) people
want then I can't say it shouldn't be there.


> >- clean up indexes
> >
>
The (new) integrated index API cleans up deleted nodes/relationships that
are left behind automatically and lazily (at least the lucene impl does) so
no worries for the index part at least. It does so by just slipping in
delete commands for such stray entities into future write transactions.

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



-- 
Mattias Persson, [matt...@neotechnology.com]
Hacker, Neo Technology
www.neotechnology.com
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to