Search code examples
springneo4jspring-dataspring-data-neo4j

What does the save() method save in Spring Data Neo4j?


The question is that what does it save?

  • Only the entity?
  • The entity and it's relationships?
  • Does it saves the relationships and the other end of those relationships?
  • Or does it save everything that the entity contains recursively and it acts as an anchor node?

Solution

  • It saves the entire subgraph that you have, the entity you're calling the save() on acts as an anchor node. In other words, the save() function operates recursively, so changes made to any connected nodes or relationships will be saved as well.

    The relationships and nodes that are not in the subgraph won't be affected.