mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-06 16:48:24 +08:00
mybatis-flex-solon-plugin:优化 SolonManagedTransaction:getTimeout 与不支持驱动器的兼容性
This commit is contained in:
parent
40c67468e9
commit
80ddea8111
@ -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) {
|
||||
return connection.getNetworkTimeout();
|
||||
} else {
|
||||
return null;
|
||||
try {
|
||||
return connection.getNetworkTimeout();
|
||||
} catch (SQLFeatureNotSupportedException e) {
|
||||
//有些驱动不支持这个特性
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user