Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -138,6 +138,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
|
||||
@@ -409,13 +410,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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user