Search code examples
javaneo4jspring-dataspring-data-neo4j

IllegalStateException Already value ReactiveNeo4JTransactionHolder for key InternalDriver bound to context


I'm using Neo4J 4.x with Spring Data, I have multiple reactive repositories.

I have a function that returns a Mono as:

return carsRepositories.findByd(id).flatmap(car -> wheelRepository.save(wheelNode)).then();

I get an error IllegalStateException Already value ReactiveNeo4JTransactionHolder for key InternalDriver bound to context.

I can findById or save the wheelNode independently, but when I chain them together, I run into that transactional problem.

Note: In my flatmap I want to set the relationship wheel->car, but I omitted that part.


Solution

  • I finally got it working.

    I removed bidirectional relationships in the graph and that solved my issue, I guess that Neo4J didn't like Car pointing to Wheel and Wheel pointing to Car.