本文介绍了弹簧隔离支持? MSQL快照隔离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用SQL Server,快照隔离可能是提高性能并解决一些死锁问题的好方法.

We are using SQL Server and it is possible that Snapshot isolation may be a good way to improve out performance and fix some deadlocking concerns.

假定我们确实有必要更改为Snapshot隔离,我似乎找不到一种简单的方法在Springs @Transactional上启用Snapshot隔离.

Assuming that we have a real need to change to Snapshot isolation, I can't seem to find an easy way to enable Snapshot isolation on Springs @Transactional.

我在Hibernate中找到了以下用于hibernate的配置选项,但是我们使用spring-jdbc,并且没有hibernate impl.这似乎表明可以通过某种方式手动提供隔离值.

I found the following hibernate configuration option for doing it in Hibernate, however we use spring-jdbc and don't have a hibernate impl. this seems to suggest that the isolation value could be provided manually somehow.

<property name="hibernate.connection.isolation">4096</property>

有人知道让Spring在事务上使用SQL Server Snapshot隔离的方法吗?

Does anyone know of a way of getting Spring to use SQL Server Snapshot isolation on transactions?

推荐答案

4096是SNAPSHOT隔离的代码,请参阅帖子此处,您必须在连接对象上设置隔离级别,我认为您无法通过@Transactional实现此目的,可以使用由提供的其他事务解决方案春天,主要是"TransactionTemplate".

4096 is code for SNAPSHOT isolation, refer post here, you have to set isolation level on connection object, I don't think you can achieve this with @Transactional, you can use other transaction solutions provided by spring, mainly 'TransactionTemplate'.

这篇关于弹簧隔离支持? MSQL快照隔离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 00:05