【问题标题】:Neo4jTransactionManager is not allowed to support custom isolation levelsNeo4jTransactionManager 不允许支持自定义隔离级别
【发布时间】:2019-09-13 10:31:56
【问题描述】:

当 jpa 方法存在自定义隔离级别时会发生这种情况 (isolation = Isolation.SERIALIZABLE)。

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

不确定 ChaniedTransactionManager 是否是原因?如果是这样,我可以分离事务管理器吗?

事务管理器

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

【问题讨论】:

    标签: spring-data-jpa spring-data-neo4j neo4j-ogm


    【解决方案1】:

    Neo4j 本身只支持读提交隔离级别。来自documentation

    5.2。隔离级别

    Neo4j 中的事务使用已提交读隔离级别,这意味着它们会在数据提交后立即看到数据,而不会看到尚未提交的其他事务中的数据。

    这就是 Spring Data Neo4j 仅支持默认隔离级别的原因。 From the documentation:

    SDN 仅支持 PROPAGATION_REQUIRED 和 ISOLATION_DEFAULT 类型的事务。

    【讨论】:

      猜你喜欢
      • 2011-07-11
      • 2019-11-14
      • 2018-10-23
      • 1970-01-01
      • 1970-01-01
      • 2015-05-20
      • 2016-09-11
      • 2020-06-16
      • 2012-03-19
      相关资源
      最近更新 更多