Polishing

This commit is contained in:
Juergen Hoeller
2020-03-24 01:23:07 +01:00
parent f20027f75f
commit 701f54b185
6 changed files with 77 additions and 98 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -129,7 +129,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
/**
* Create a new DataSourceTransactionManager instance.
* @param dataSource JDBC DataSource to manage transactions for
* @param dataSource the JDBC DataSource to manage transactions for
*/
public DataSourceTransactionManager(DataSource dataSource) {
this();
@@ -137,6 +137,7 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
afterPropertiesSet();
}
/**
* Set the JDBC DataSource that this instance should manage transactions for.
* <p>This will typically be a locally defined DataSource, for example an
@@ -408,13 +409,9 @@ public class DataSourceTransactionManager extends AbstractPlatformTransactionMan
throws SQLException {
if (isEnforceReadOnly() && definition.isReadOnly()) {
Statement stmt = con.createStatement();
try {
try (Statement stmt = con.createStatement()) {
stmt.executeUpdate("SET TRANSACTION READ ONLY");
}
finally {
stmt.close();
}
}
}