Delete All with SDN

I am using SDN in Spring Boot 3.0.6. I have extended the Neo4jRepository. I have defined an Entity that has three relationships. One relationship is a collection and the other two relationships are directly too entities.

I am able to create the root entity with their related entities and use the repository's save method to save the root entity and its descendants. I am able to retrieve all the entities with the findAll method. It correctly returns the root entity and all its descendants. For both save and find, the methods operate on the entire tree. My problem is that the delete methods, either by id or entity, only delete the root entity and leave the descendants. I thought the framework operated on the entire tree. All the entities are annotated with Node. What am I missing?

While I am posting, I would like to ask where I can find documentation on the Neo4jClient and Neo4jTemplate? It is missing from the Spring Neo4j Documentation.

Thanks in advance.

documentation on the Neo4jClient

SDN reference documentation contains information on both reactive and none-reactive clients.

delete methods, either by id or entity, only delete the root entity and leave the descendants. I thought the framework operated on the entire tree

That's obviously an opinionated decision.

Personally, I found this behavior intuitive, but I wish it to be documented.

I guess you are validating the behavior and I am not missing anything. I assume there is not an option for cascading deletion?

I went ahead and added methods in my repo with queries to delete the root node and descendants (by id and all). Was very simple.

You are correct. I did read the info on the Neo4jClient. I forgot.
I didn't see anything on the template. After reviewing the available methods on a template, it seems it provides the same functions as the repository, with the freedom to use in anywhere.

thanks for the help.

I'm exploring SDN by examining the repository, documentation and observing behavior (just like you). I didn't find a way to switch on/off cascading (something like cascade attribute in JPA).

I didn't see anything on the template. After reviewing the available methods on a template, it seems it provides the same functions as the repository, with the freedom to use in anywhere.

I'm either find no official materials on Neo4j template apart from the javadoc.

As I understood, template is an abstraction one layer below the repository. It gives a little bit more freedom in terms of mapping the target entity type than repository.

From the perspective of Spring, it's a managed bean (like repository, client and driver) and hence can be aspected or injected in any other bean.

I guess a use case for the template would be a situation when there's no repository for a particular entity because of the complicated persistence logic that require utilizing low-level abstractions (driver or client), and there's a simple case when we don't need this heavy artillery and can go with template by providing the query and Class<T>.