File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
APIJSONORM/src/main/java/apijson/orm Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -764,13 +764,18 @@ public void setTransactionIsolation(int transactionIsolation) {
764764 }
765765
766766 @ Override
767+ private boolean setIsolationStatus = false ; //设置事务等级
767768 public void begin (int transactionIsolation ) throws SQLException {
768769 Log .d ("\n \n " + TAG , "<<<<<<<<<<<<<< TRANSACTION begin transactionIsolation = " + transactionIsolation + " >>>>>>>>>>>>>>>>>>>>>>> \n \n " );
769770 //不做判断,如果掩盖了问题,调用层都不知道为啥事务没有提交成功
770771 // if (connection == null || connection.isClosed()) {
771772 // return;
772773 // }
773- connection .setTransactionIsolation (transactionIsolation );
774+ connection .setAutoCommit (false );
775+ if (! this .setIsolationStatus ){ //只设置一次Isolation等级 PG重复设置事务等级会报错
776+ connection .setTransactionIsolation (transactionIsolation );
777+ }
778+ this .setIsolationStatus =true ;
774779 connection .setAutoCommit (false ); //java.sql.SQLException: Can''t call commit when autocommit=true
775780 }
776781 @ Override
You can’t perform that action at this time.
0 commit comments