问题
Prior to migrating my project to SDN 4, I used my own custom REST client code which generated Cypher statements of the form:
MERGE (n:LABEL1:LABEL2 {prop1:"val"...})
ON CREATE SET ...
ON MATCH SET ...
This had the desired effect of creating nodes which needed to be created, and updating existing nodes where necessary.
However, using .save(...) on the SDN 4 Neo4jTemplate, only CREATE Cypher statements appear to be generated, resulting in duplicate nodes, where what is desired is new nodes are created if necessary and existing nodes are updated and new relationships are added to existing nodes where possible.
Is there a way to influence the SDN 4 Neo4jTemplate behaviour to use MERGE rather than CREATE?
来源:https://stackoverflow.com/questions/31297127/sdn-4-how-to-cause-sdn-4-to-use-merge-rather-than-create