I just encountered an interesting behaviour with Spring Data for Neo4j, and I'm wondering if it is my mistake, or some strange bug.
I am attempting to save the collection of neo4j entities all at once. The method signature promises to return an instance of Iterator over these just saved entities. I am assuming that the result will be Iterator over persited entities, containing newly assigned IDs. However, return value is null, unlike calling a save operation over single entity:
Iterable<PhysicalMachine> savedPMs = this.physicalMachineRepository.save(pms);
Data is persisted, and I can see it in the database right after the call (even during debugging). However, "savedPMs" is null, which of course throws a null pointer in the next call...
Am I missing something trivial here?
This was fixed in 4.1.1.RELEASE, see https://jira.spring.io/browse/DATAGRAPH-760
Note:
It's also recommended that you upgrade to 4.1.1, there aren't any fixes happening in the 4.0 line. Theres a short guide to upgrading here: http://graphaware.com/neo4j/2016/02/24/upgrading-spring-data-neo4j-4-1.html