chenjh3 2023-08-21 16:45:17 +08:00
parent dcce259e08
commit 1db2e81f45

View File

@ -69,14 +69,14 @@ public class FlexSpringTransaction implements Transaction {
@Override @Override
public void commit() throws SQLException { public void commit() throws SQLException {
if (!isTransaction && !autoCommit) { if (isHoldConnection() && !isTransaction && !autoCommit) {
getConnection().commit(); getConnection().commit();
} }
} }
@Override @Override
public void rollback() throws SQLException { public void rollback() throws SQLException {
if (!isTransaction && !autoCommit) { if (isHoldConnection() && !isTransaction && !autoCommit) {
getConnection().rollback(); getConnection().rollback();
} }
} }
@ -90,4 +90,8 @@ public class FlexSpringTransaction implements Transaction {
public Integer getTimeout() throws SQLException { public Integer getTimeout() throws SQLException {
return null; return null;
} }
private boolean isHoldConnection() {
return !connectionMap.isEmpty();
}
} }