Oct 18th, 2012, 02:59 PM
[neo4j] Exception persisting nodes with duplicate unique keys
I am trying to use the unique entity support of Spring Data Neo4j. I have annotated a field with @Indexed(unique=true)
I found that this is working, since no duplicate nodes are being created in the database. But I cannot catch the exception while persisting it.
I want to do something like the following
catch (SomeException e)
Does anybody have any idea, how to do this ?
Oct 20th, 2012, 07:03 PM
Neo4j's unique indexes work like that, if the entity is already in the graph you get it back, otherwise it is created for you.
It is rather a "getOrCreate()" operation. Not so much we can do in the SDN world about it.
You can compare the object on your side but they should be equal anyway.
Tags for this Thread