mybatis-flex-solon-plugin:优化 SolonManagedTransaction:getTimeout 与不支持驱动器的兼容性

This commit is contained in:
noear 2024-12-18 17:15:08 +08:00
parent 40c67468e9
commit 80ddea8111

View File

@ -7,6 +7,7 @@ import org.noear.solon.data.tran.TranUtils;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
/**
* @author noear
@ -54,9 +55,13 @@ public class SolonManagedTransaction implements Transaction {
@Override
public Integer getTimeout() throws SQLException {
if (connection != null) {
try {
return connection.getNetworkTimeout();
} else {
} catch (SQLFeatureNotSupportedException e) {
//有些驱动不支持这个特性
}
}
return null;
}
}
}