Search code examples
neo4jneo4j-ogm

neo4j ogm different save policies


Is there a possibility to change save policy.

For example I have node Person with properties name=A, surname and address.

Now I want to save object Person with same Entity Id, and with property name=B.

Can i choose somehow:

  1. to only override that name property and leave surname and address.
  2. to delete surname and address and only insert name=b.

Solution

  • No, these policies do not exist in the OGM. When you save a node entity, the OGM will detect if any properties have changed, and update all properties. If you've only updated the name to B, but left the surname and address as before, then the effect of save is to update the name to B. If you update name to B but set surname and address to null, then the effect of save is to update the name to B, and remove the values of surname and address.