Search code examples
javaspringneo4jspring-data-neo4j-4neo4j-ogm

Spring Data Neo4j and transactions in chained services


I have a service for example

public class ServiceA {

    @Transactional
    public void a() {
        ...
        serviceB.b()
        ...
    }
}

that calls a method of another service

public class ServiceB {

    @Transactional
    public void b() {
        ...
        graphRepository.save(..)
        ...
    }
}

that calls a method of a GraphRepository.

If there isn't any problem during the execution of the GraphRepository method everithigs works well, but if an exception occurs in the GraphRepository the rollback doesn't work and all calls to the remote db are blocked.

If I remove the Transactional annotation over the b() everithins works well even if an exception occurs in the GraphRepository.

I can't explain this behavior.

Can you help me?


Solution

  • Thank to Luanne and her comment I solved the issue

    This is a bug and it is solved in neo4j-ogm 1.1.5-SNAPSHOT