0

There. I'm using sdn4 with java 8.

I make this relation

Owner -Has- truck.

and delete truck using truckReposity(extends GraphRepository).
If checking truck is deleted in Neo4j broswer, It is deleted.

but Running web application has still have truck.

owner.removeTruck(truck);
ownerRepository.save(owner);
truckRepositry.delete(truck);

I'm using these codes. Can I delete truck with relation other way?

reperion
  • 129
  • 9
  • If you removeTruck(truck) correctly removes references from both owner and truck, then using repository.delete should not require the cache to be cleared. If it does, please open an issue at https://jira.spring.io/browse/DATAGRAPH with a test case/sample code, thanks! – Luanne Mar 03 '16 at 15:22

1 Answers1

0

For deleting the SDN cache you can use neo4jTemplate.clear(); or session.clear()

Apart form that, I think it is because of the “Smart Object Mapping” that owner still has a relationship to truck. If you query for owner again, after you have deleted truck from neo4j it should be gone.

fkorn
  • 50
  • 6
  • session.clear should only be required when an entity or relation is deleted via a custom query. As long as object references are removed, using repository or session delete should work as expected – Luanne Mar 03 '16 at 15:23