How to properly save a node in Spring Data Neo4j

Good afternoon,

I am saving a node directly with the .save method that the repository gives me and I am wondering if I want to update the data of my Publication node, I have to place all its data and the data of the related nodes and so on.

I just noticed that if I store for example:

"id": "f8e75445-9728-4342-9e69-15149d5c71f0",
"title": "Quibusdam vero ea cupiditate annoyinge.",
"publishBy": {
         "publishDateTime": "2023-09-23T15:41:19.6320888",
         "userApp": {
             "id": "b36f0213-15ba-4fb8-bad8-36bad26eb60b",
             "email": "dairon3@example.com",
             "friends": [],
             "follows": []
         }
     }, ......

then the user who published the post would have from this save his friends and follows equal to null.

What is the recommended practice for updating information with neo4j spring data?

Would it be that for each update or creation of a relationship between nodes I have to do it with direct queries in cypher from the repository?

I would like someone to guide me on the correct way to do it.

Cordially greetings.

The use case for SDN is to manage domain objects. Its behavior is to sync your Java object to neo4j entities. You need to have all the information in your Java object when you save/update them. Anything missing will be removed upon save/updated.

I use SDN when I have isolated domain objects. I use the driver (or Neo4hClient from SDN) to manage my entities that are connected like a network. These don’t fit the use of SDN because the extent of the neo4j entities are not isolated.

1 Like