0
我正在使用spring引導並希望將默認隔離級別更改爲READ_UNCOMMITTED
。更改隔離級別 - hibernate.connection.isolation不起作用
我搜索並找到屬性hibernate.connection.isolation
,但我試過了,它沒有奏效。
我的配置是這樣的:
private Properties additionalJpaProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.hbm2ddl.auto", "validate");
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.SQLServerDialect");
properties.setProperty("hibernate.connection.isolation", String.valueOf(Connection.TRANSACTION_READ_UNCOMMITTED));
return properties;
}
@Primary
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) throws SQLException {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan(this.packages);
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(this.additionalJpaProperties());
return em;
}
如何更改使用彈簧啓動的隔離級別?