Search code examples
spring-data-jpaspring-data-neo4jneo4j-ogm

Neo4jTransactionManager is not allowed to support custom isolation levels


This happens when there is a custom isolation level present for a jpa method ( isolation = Isolation.SERIALIZABLE).

    @Override
    @Transactional(readOnly=false, isolation = Isolation.SERIALIZABLE)
    public Lis saveAll(List<Price> prices) {
..
    }`

Not sure if the ChaniedTransactionManager is the cause? if so, can I separate Transaction Managers?

Transaction Manager

@Bean(name = "transactionManager")
    public PlatformTransactionManager transactionManager(){
        return new ChainedTransactionManager(new JpaTransactionManager(entityManagerFactory().getObject()),
                new Neo4jTransactionManager(sessionFactory));
    }

Solution

  • Neo4j itself supports only read committed isolation level. From the documentation:

    5.2. Isolation levels

    Transactions in Neo4j use a read-committed isolation level, which means they will see data as soon as it has been committed and will not see data in other transactions that have not yet been committed.

    That's why Spring Data Neo4j supports only default isolation level. From the documentation:

    SDN only supports PROPAGATION_REQUIRED and ISOLATION_DEFAULT type transactions.