Spring Isolation Support? MSQL Snapshot Isolation

大憨熊 提交于 2020-01-14 20:07:31

问题


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.

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.

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>

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


回答1:


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'.



来源:https://stackoverflow.com/questions/8983873/spring-isolation-support-msql-snapshot-isolation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!