Closed
Description
When I try to upgrade mybatis-spring from 1.3.2 to the version after 2.0.0. The upgrade breaks my existing code when I extend SpringManagedTransaction and override method Close with SQLException. e.g.
public class Demo extends SpringManagedTransaction{
private Connection connection;
public Demo(DataSource dataSource) {
super(dataSource);
}
@Override
public void close() throws SQLException {
try {
if(connection != null){
if(!TransactionSynchronizationManager.isSynchronizationActive()){
if(connection.isReadOnly()){
connection.setReadOnly(false);
}
}else if(!TransactionSynchronizationManager.isActualTransactionActive()){
if(connection.isReadOnly()){
connection.setReadOnly(false);
}
}
}
} catch (Exception e) {
LOGGER.error("ha reset read only error:" + e.getMessage(), e);
}
super.close();
}
}
The code should pass. However, it throws an error:
close() in Demo cannot override close() in org.mybatis.spring.transaction.SpringManagedTransaction
overridden method does not throw java.sql.SQLException